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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:12:11+00:00 2026-05-28T18:12:11+00:00

I have a table as follows <div id=div13 class=ctnr> <table id=mainTable13 class=dtable cellpadding=3 cellspacing=1

  • 0

I have a table as follows

<div  id="div13" class="ctnr">
  <table id="mainTable13" class="dtable" cellpadding="3" cellspacing="1" border="0">
    <thead>
        <tr><th>*</th><th>Proposal</th></tr>
    </thead>
    <tbody id="tbdy">
       <tr id="zrow0" class="gradeX">
          <td><input id="ckb0"      type="checkbox" /></td>
          <td        id="proposal0" style="width:55%">This is a comment</td>
       </tr>
    </tbody>
  </table>
</div>

It is referenced in code as follows:

function extractRowCell(divNode){
// Here we will extract all the checked Proposals...
var all = ''
var i=0
var dnode = '#'+divNode.id   //  First construct a CSS-like ref to the node's ID 
var mTable = dnode.replace("div","mainTable")+' '+"#tbdy tr "   //Ref to the DataTable.TopRow in the DIV
//alert(mTable);
$(mTable).each(function() {    
    //alert($(dnode+' #proposal'+i).text());
    //alert($('#ckb'+i+':checked').val());
    if ($('#ckb'+i+':checked').val() !== undefined) {
        alert($(dnode+' #proposal'+i).text());
        all = all+$(dnode+' #proposal'+i).text()+ '\n\n\n';
        }
    i=i+1;
    alert(all+'     \n'+mTable+'#proposal'+i);
    });
}

The question is why do the two commented out alerts require different selector constructions??? I am completely puzzled by this! Here, let me unscramble them and put them side by side…

    alert($('#div13 #proposal1'   ).text());
    alert($(       '#ckb1:checked').val());

Effectively the second selector does not need to indicate that it sits in the 13th div (“#div13”), while the one above without the “#div13” would reach out to “#div1”. But if you precede the second one with the “#div13” the test gives the value false all the time.

I will admit that I am confounded! I have been fighting this all day today! No clue! Any brave soul who can set me straight is my hero!

Dennis

  • 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-28T18:12:12+00:00Added an answer on May 28, 2026 at 6:12 pm

    Ideally the ids of element should be unique on a page. If you follow that they you don’t need any prefix for id selector to restrict the elements to match on the page.

    In your case what is happening is when you prefix #div13 to #ckb1 jQuery will look for #ckb1 inside #div13 otherwise it will search in the whole page. When you don’t specify the prefix #div1 if there are multiple elements with same id jQuery will select first element whose id matches and include it in the matched set.

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

Sidebar

Related Questions

print '<div id=wrap>'; print <table width=\100%\ border=\0\ align=\center\ cellpadding=\3\ cellspacing=\3\>; for($i=0; $i<count($news_comments); $i++) {
I have a HTML code as follows; <div>Content table with varying height</div> <div id=buttons>
I have my div as follows <div class=menu id=admindiv runat=server> <ul> <li><a href=>welcome to
I have a table as follows > RowID SessionID EventID RequestedURL Date > 1
I have a table like as follows: SoftwareName Count Country Project 15 Canada Visio
I have a table set up as follows id origin destination carrier_id so typical
We have a table set up as follows: |ID|EmployeeID|Date |Category |Hours| |1 |1 |1/1/2010
I have a table with sales per store as follows: SQL> select * from
The architecture for this scenario is as follows: I have a table of items
I have a bidding table, as follows: SellID INT FOREIGN KEY REFERENCES SellItem(SellID), CusID

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.