उदाहरण
jQuery सेलेक्टर :last का उपयोग करके लास्ट आइटम प्राप्त करें।
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table id="demo" border="1">
<tr> <td>John</td> </tr>
<tr> <td>David</td> </tr>
<tr> <td>Mike</td> </tr>
</table>
<script>
var lastValue = $('table tr:last td').text();
console.log("The last value is=" + lastValue);
</script>
</body>
</html>
फ़ाइल सेव करें और Live Server से खोलें।
आउटपुट
कंसोल में टेबल के लास्ट रो का टेक्स्ट दिखाई देगा।