jquery first selector
Translation results:
first
UK[fɜ:st] US[fɜ:rst]
n.First, initially; first class; number one,; [乐] Treble part
adv.First time; earliest, first; rather; priority
adj. First-rate; initial, earliest; basic, summary; treble
num.First
jquery first selectorsyntax
Function: :first selector selects the first element. Most common usage: Used with other elements to select the first element in a specified combination (like the example above).
Syntax: $(":first")
jquery first selectorexample
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p:first").css("background-color","#B2E0FF"); }); </script> </head> <body> <html> <body> <h1>Welcome to php中文网</h1> <p class="intro">php教程视频</p> <p>php手册</p> <p>php词典</p> <div id="choose"> Who is your favourite: <ul> <li>php教程视频</li> <li>php手册</li> <li>php词典</li> </ul> </div> </body> </html> </body> </html>
Click the "Run instance" button to view the online instance