jQuery last()
此方法獲取匹配元素集合中的最後一個元素。
jQuery1.4版本新增。
語法結構:
[JavaScript] 純文字檢視 複製程式碼$(selector).last()
程式碼例項:
[HTML] 純文字檢視 複製程式碼執行程式碼<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function () { $("li").last().css("color","blue") }) </script> </head> <body> <div> <ul> <li>HTML專區</li> <li>Javascript專區</li> <li>Div+Css專區</li> <li>Jquery專區</li> </ul> </div> </body> </html>
上面的程式碼可以將最後一個li元素的字型顏色設定為藍色。
相關文章
- jQuery :last-of-typejQueryAST
- jQuery :last-childjQueryAST
- jQuery :nth-last-of-type()jQueryAST
- jQuery :nth-last-child()jQueryAST
- jQuery :last選擇器jQueryAST
- Last WinnerAST
- Last danceAST
- 7.121 LASTAST
- Who is the Last Change?AST
- E:last-child與E:last-of-type區別AST
- linux命令:lastLinuxAST
- Last digit of a huge numberASTGit
- CSS E:last-childCSSAST
- CSS E:last-of-typeCSSAST
- Length of Last Word leetocde javaASTJava
- 複用- build for last (轉)UIAST
- 7.122 LAST_DAYAST
- 天國的《The Last Night》AST
- Linux基礎命令—lastLinuxAST
- Linux基礎命令---lastLinuxAST
- Traceback (most recent call last):AST
- The last major melee archetype includes the sneakyAST
- Leetcode Length of Last WordLeetCodeAST
- 分析函式——NULLS FIRST/LAST函式NullAST
- BEAer Last Day, Tomorrow OraclerASTOracle
- :last-child與:last-of-type你只是會用,有研究過區別嗎?AST
- [leetcode]length-of-last-wordLeetCodeAST
- CSS E:nth-last-of-type(n)CSSAST
- CSS E:nth-last-child(n)CSSAST
- 【Mysql】Last_SQL_Error: 1594MySqlASTError
- Oracle的LAST_DAY函式OracleAST函式
- Last 與 break flag 的區別AST
- 清除last和history的記錄AST
- 【leetcode】length of last word (easy)LeetCodeAST
- Leetcode-Length of Last WordLeetCodeAST
- 同步故障Last_Errno:1051AST
- The Last Reader Response——13-17AST
- v$datafile中的last_change#AST