Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find a table of certain class with jquery selectors

How do I select just a table with class d with jquery selectors. For some reason this code won't work properly...

var dTableTags = $(".d table");

example table would be...

<table id="thetable" class="d">
  <thead>
    <tr><th>Column 1 header</th><th>Column 2 header</th></tr>
  </thead>
  <tbody>
    <tr><td>Column 1 data</td><td>Column 2 data</td></tr>
  </tbody>
</table>
like image 333
MTAG11 Avatar asked Nov 08 '12 18:11

MTAG11


1 Answers

Your selector is wrong; try $("table.d") instead.

The jQuery documentation does not explain this directly, it defers to the W3C CSS selector documentation which is a lot more comprehensive.

like image 187
Richard Ev Avatar answered Oct 17 '22 05:10

Richard Ev