Example of last () method usage in jQuery, jquerylast
This document describes the usage of the last () method in jQuery. Share it with you for your reference. The specific analysis is as follows:
This method is used to obtain the last element in the element set.
Syntax:
Copy codeThe Code is as follows: $ (selector). last ()
Instance:
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Head>
<Title> helping customers </title>
<Script type = "text/javascript" src = "js/1.4.4/jquery. min. js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("Li" ).last().css ("color", "blue ")
})
</Script>
</Head>
<Body>
<Div>
<Ul>
<Li> HTML zone </li>
<Li class = "js"> Javascript area </li>
<Li> Div + Css area </li>
<Li> Jquery area </li>
</Ul>
</Div>
</Body>
</Html>
I hope this article will help you with jQuery programming.