:last Selector - Selectors , jQuery |
:last Selector() เป็นการใช้ Selectors กับ :last Selector() คือในการอ้างถึง element ที่ ลำดับของ index ที่ last หรือ ที่อยู่ในลำดับ สุดท้าย
Syntax
Example ตัวอย่างการใช้งาน :last Selector()
lastSelector.html

01. <html>
02. <head>
03. <title>ThaiCreate.Com jQuery Tutorials</title>
04. <script type= "text/javascript" src= "jquery-1.6.4.js" ></script>
05. <script type= "text/javascript" >
06.
07. $(document).ready( function (){
08.
09. $( "tr:last" ).css({backgroundColor: 'yellow' , fontWeight: 'bolder' });
10.
11. });
12. </script>
13. </head>
14. <body>
15.
16. <table>
17.
18. <tr><td>First Row</td></tr>
19. <tr><td>Middle Row</td></tr>
20. <tr><td>Last Row</td></tr>
21.
22. </table>
23.
24. </body>
25. </html>
Screenshot

คำอธิบาย (ภาษาไทย)
จากตัวอย่างเป็นการใช้ Selectors กับ :last Selector() ในการอ้างถึง element เช่น $("tr:last") คือการอ้างถึง element ที่ <tr> อยู่ในลำดับสุดท้าย
ลิ้งค์ที่ควรศึกษา
Go to : jQuery Selectors : jQuery Selectors and Element
เกี่ยวกับบทความ
ส่วนหนึ่งของบทความได้เรียบเรียงและแปลจากเว็บไซต์ jQuery.Com โค้ดตัวอย่างคำสั่งนี้อยู่ภายใต้สัญญาอนุญาตของ GFDL สามารถนำโค้ดและคำสั่งใช้งานได้ฟรี สงวนลิขสิทธิ์เฉพาะคำอธิบายภาษาไทย
|
|
Total Votes: 201Overall Rating: 3.9 / 5 |
|
 |
|
|
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท
|
|
|
By : |
ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ) |
|
Score Rating : |
  |
|
|
Create/Update Date : |
2011-09-22 20:35:44 /
2011-10-22 08:01:54 |
|
Download : |
No files |
|
Sponsored Links / Related |
|
|
|
|
|
|