jQuery > Traversing methods

.last() - Find last element in jQuery

How to find the last element form the matched element in jQuery?


To find the last element from the group of matched element, last() method can be used.

 <script>
      $("div li").last().html("<b>Changed</b>");
  </script>

Above code snippet will change the html value of the last “li” element found under each “div” element of the page.

 Views: 9056 | Post Order: 46



Write for us






Hosting Recommendations