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.

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

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

 Views: 1366 | Post Order: 46

Write for us