Reputation: 853
I am creating and filling an HTML table using PHP. During this each TR gets a certain class.
Is there a way I can count how many elements have this class so that I can echo the number somewhere on the page on page load ? (Other TRs would have different or no classes.)
Example TR:
<tr class="myClass"></tr>
Many thanks in advance, Mike.
Upvotes: 0
Views: 1292
Reputation: 45
You use jQuery (enter link description here)
var n = $( "myClass" ).length;
Upvotes: 0