Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:41:06+00:00 2026-05-13T15:41:06+00:00

I have the following html that renders within an ASP.NET Repeater: <div class=divDE-item onclick=addFilter(this);>

  • 0

I have the following html that renders within an ASP.NET Repeater:

<div class="divDE-item" onclick="addFilter(this);">
  <span class="spnKey">Some key</span>
  <div>1234</div>
</div>

I realize that having an onclick on the outer div may not be the most graceful jQuery-centric approach. However, considering my situation, it works well.

Here is my addFilter() function:

function addFilter(oDiv) {
  $(document).ready(function() {
    // Get and set the prefix text for the label. i.e. "Key = "
    sDEName = $(oDiv).find("span").text();
    $('#<%= lblDEName.ClientID %>').text(sDEName + " = ");

    // Get the actual filter text value. i.e. "1234"
    // sFilter = $(oDiv).text();
    var sFilter = $(oDiv).filter(function() {
        var filtered = $(this).not(".spnKey");
        return filtered
    });

    $('#<%= txtValue.ClientID %>').val(sFilter);
  });
}

The goal is for the output to appear like this (with 1234 being the value of a textbox):

Some key = 1234

However, the output I’m getting is: Some key = Some key 1234

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:41:06+00:00Added an answer on May 13, 2026 at 3:41 pm

    You don’t need to call filter.

    You can simply write $('div:not(.spnKey)', oDiv).text().

    To answer your question, you’re using filter and not wrong. The filter method returns a jQuery object containing some of the elements in the one you call it on. (Not their children). To use it this way, you should call $(oDiv).children().filter(...).

    The not method is the opposite of filter, and returns the elements in the jQuery object that don’t match a selector of function. You could therefore also write $(oDiv).children().not('.spnKey').

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have some html that looks like the following: <div class='something unknown' id='something_unknown_1'>
i have the following problem with that code in my html tag: <div id=searchbar><input
I have a single .html file that looks similar to the following: <div id=myPage
I have the following two templates parent.html <ul class=basketItems> {% for item in items
I have an html page that renders something similar to the following table: nov.
I have a checkbox created as follows: <td class=center>@Html.DisplayFor(modelItem => item.IsBusinessHours)</td> It renders as
I have the following HTML that pops up a window when I click the
I have the following HTML that can appear but only one at a time:
I have the following html/css that is causing problems in Firefox 1.5 and 2,
I have the following html code: I saw that for Watir-webdriver the Watir::Image.file_size method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.