I am having a HTML table with many rows. I have seven columns in it. Each cell (<td>) in the table has an ID attribute with grid[x][y] with x and y representing columns and rows respectively.
Example <td>s are
<td id="grid[2][2]" class="available"...> -- This indicates 3rd column 3rd row
<td id="grid[2][4]" class="unavailable"...> -- This indicates 3rd column 5th row
and so on.
Now I need to write a query which gives me the count of columns with class=”available” or class=”unavailable”. How to write it in jQuery?
So, for getting first column which has class=”available” it would be something like this,
(id = grid[0]* and class == "available").size
Please help me transform the above (a stupid query) into a meaningful jQuery.
Here,
should give you number of td’s with class available and 0 row. And you can change row number and get others.