I’m trying to get the highest number (8 in example below) from the table cells with specific class. I’m assuming I’ll have to convert it to an array and then do math.max on it?
This is my HTML code:
<table>
<tr>
<td class="id">3</td>
</tr>
<tr>
<td class="id">8</td>
</tr>
<tr>
<td class="id">4</td>
</tr>
</table>
This is really what I’ve tried, but it just returns 384. So math.max doesn’t work on it.
var varID = $('.id').text();
var varArray= jQuery.makeArray(varID);
alert (varArray);
I think the best way would be:
jsfiddle example