I have a div having n number of tables, now i want to alert all table ids inside that div only using jquery.
Here is the example code :
<div id="myDiv">
<table id="table1"><tr><td>hello</td></tr></table>
<table id="table2"><tr><td>hello</td></tr></table>
<table id="table3"><tr><td>hello</td></tr></table>
<table id="table4"><tr><td>hello</td></tr></table>
<table id="table5"><tr><td>hello</td></tr></table>
</div>
Assume that i already know div id which is 'myDiv'.
Thanks.
Try,
$('#myDiv table').each(function(){
alert(this.id);
});
Working Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With