Scroll all the checkboxes that are inside the div tag

I need to skip all the checkboxes that are inside the div tag with id # abc123

How can i do this?

$("#abc123").foreach( ???? )

The update my html line looks like this:

<tr>
<td><input .../> </td>
<td>234</td>

</tr>

I need to add a value <td>to the checkbox id.

Would I just get a parent, and then somehow his ancestor?

+5
source share
4 answers
$("#abc123 input[type=checkbox]").each(function()
     {

     });

UPDATE:

Okay, let's see if I understood this directly. Given:

<tr> 
<td><input .../> </td> 
<td>234</td> 
</tr>

You want the result to be (effective)

<tr> 
<td><input id="abc234" .../> </td> 
<td>234</td> 
</tr>

$("td input[type=checkbox]").each(function()
{
     var id = $(this).next("td").text();
     $(this).attr("id", "abc"+ id);
});
+7
source
$("#abc123 input[type=checkbox]").each(function() {
    $(this).dosomething();
});
+5
source

onkeydown... keycode "9"

$(document).keydown(function(e){
  if(event.keyCode == '9'){ 
  ... 
}

if statement nested if statement, , , , :

document.div.id.focus();
0

You did not indicate where it #abc123is in your code. Also, are there tags <td>for identification? The following may work.

$("#abc123 input:checkbox").each(function(i) {
    id = $(this).closest('td').next('td').text();
    $(this).attr('id', id);
});

I'm not sure how deep yours <div id="abc123">is in <td>, so I used the closest () method to access the cell wrapper. If it is only 1 depth, i.e. No <div>, as it appears in your code, then you can just use parent (). Good luck.

0
source

All Articles