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 8520949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:40:35+00:00 2026-06-11T06:40:35+00:00

When I do a .find with a name=value selector, I’m getting no elements. My

  • 0

When I do a .find with a name=value selector, I’m getting no elements. My syntax looks correct and I can’t see what I’m doing wrong. I know the object that it is selecting from has elements, 7 to be exact, with the attribute I’m looking for. So I’m stumped as to why the .find is not working.

Javascript on page:

$(document).ready(function () {
        var mainCatName = 'category.SelectedValue'
        $('#Button1').on('click', function () {
            var td = $('input[name="' + mainCatName + '"]:checked').parent('td');
            var tdIndex = td.index();
            if (selectElems == null) {
                //1 
                selectElems = $("#pumpConfigTable td:nth-child(" + (tdIndex + 1) + ") select,  #pumpConfigTable td:nth-child(" + (tdIndex + 1) + ") input");
            }

            var projectInfoID = $('#ProjectInfoID').attr('value');
            var mainCategoryID = $('input[name="' + mainCatName + '"]:checked').attr('value');
            var postBackObject = makeProjectInfoObjects(projectInfoID, mainCategoryID, selectElems);
            var blah = "blah";
        });


    });

Partial source for makeProjectInfoObjects:

function makeProjectInfoObjects(pInfoID, mainCatID, pcOptions) {

    //var pc = new PumpConfig();
    var pc = new Array();
    var dbIDs = _.pluck(pcOptions, "data-dbid");
    var uniquedbIDs = _.unique(dbIDs);
    uniquedbIDs = _.reject(uniquedbIDs, function (checkID) { return checkID == undefined; });
    var len = uniquedbIDs.length;

    for (var i = 0; i < len; ++i) {
        //2
        var categories = $(pcOptions).find("[data-dbid='" + uniquedbIDs[i] + "']");
        var uniqueNames = _.pluck(categories, "name");
        var singleOptions = $(categories).find(':not([name]');
        var soLen = singleOptions.length;
        for (var j = 0; j < soLen; ++j) {
            pc.push({
                pcID: uniquedbIDs[i],
                pInfoID: pInfoID,
                configCatID: mainCatID,
                configSubCatID: $(singleOptions[i]).attr('data-subcatid'),
                configValue: $(singleOptions[i]).attr('value')
            });

I’m using JQuery 1.8.1 and IE8 on XP.

According to IE Developer Tools the first selector comes out to be this (and it works):
//1 "#pumpConfigTable td:nth-child(2) select, #pumpConfigTable td:nth-child(2) input"

The second selector comes out to be this (and it doesn’t work):
//2 "#pumpConfigTable td:nth-child(2) select, #pumpConfigTable td:nth-child(2) input [data-dbid='1']"

  • 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-06-11T06:40:36+00:00Added an answer on June 11, 2026 at 6:40 am

    If you wish to find input and select elements with a specific attribute data-dbid then you shouldn’t use find() as this method searches for elements that are descendants of the elements you are selecting with your selector string:

    "#pumpConfigTable td:nth-child(" + (tdIndex + 1) + ") select,  #pumpConfigTable td:nth-child(" + (tdIndex + 1) + ") input"
    

    Your matched elements will be select elements and input elements. I think I’m correct in assuming you want to find specific elements within this set? If so, try using jQuery’s filter() method instead of find.

    .filter( selector )

    Returns: jQuery

    Description: Reduce the set of matched elements to those that match the selector or pass the function’s test.

    So you would do this:

    var categories = $(pcOptions).filter("[data-dbid='" + uniquedbIDs[i] + "']");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I receive a string value, find an Entity with the same name
I am trying to find simple, elegant way to get all the pertinent name,value
Is there any way to make find-name-dired to only show filenames that I can
I'm want to create a selector to find elements which have attributes starting with
I have a name/value pair in a List<T> and needing to find the best
I usually use like this $ find -name testname.c ./dir1/dir2/testname.c $ vi ./dir1/dir2/testname.c it's
I want to do something on the lines of: find -name *.mk | xargs
Okay so I am running a simple command like this: find / -name ssh
In this snippet: find( sub { print found . $File::Find::name . \n; }, (.));
I am trying to execute a command like this: find ./ -name *.gz -print

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.