Find second last row from table
I have a table with a dynamic row and I want to find the second last row from the table.
HTML code
<table class="table">
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
<tr><td>5</td></tr>
<tr><td>6</td></tr>
<tr><td>7</td></tr>
<tr><td>8</td></tr>
<tr><td>9</td></tr>
<tr><td>10</td></tr>
</table>
JQuery code
alert($(".table").find("tr:last").find("td").html());
I tried with tr:last
, but it gave me the last line with the value 10
.
Expected Result
The second value of the last line 9
instead of10
+3
source to share