I would like to select all the tables where the id starts with the same sentence, with jQuery.
This what I mean:
<table id="Tab_01">
<tr>
<td>....
<tr>
....
</table>
<table id="Tab_02">
<tr>
<td>....
<tr>
....
</table>
<table id="Tab_03">
<tr>
<td>....
<tr>
....
</table>
<table id="xyz">
<tr>
<td>....
<tr>
....
</table>
What I need, is to select the tables that start with "Tab_" and not the table with id = "xyz"
I would like to use this code for making a similar navigation with this plugin : http://projects.allmarkedup.com/jquery_evtpaginate/demo_basic.html
Could anyone help me?
Try this:
$('table[id^=Tab_]')
Padolsey created a good plugin for this. Check it here.
$("table:regex(id, ^Tab)")
this is the best optimized way of doing this.
Use a filter()
:
$('table').filter(function(index){
return this.id.substring(0,4) == 'Tab_';
});
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