Get started with jquery selector:
①id How to use selectors:
<input id= "goto" value= "goto Beijing" ></input>
Console.info ($ ("#goto"). Val ());
②name selector:
<input name= "goto" value= "Goto Xian" ></input>
Console.info ($ ("Input[name= ' Goto ']"). Val ());
③ Property
<input type= "image" Id= "IMGs" >
Set src Property
$ ("#imgs"). attr ({src: "jquery/tulips.jpg", alt: "Picture"});
④ Setting the value of input
<input name= "Go" type= "Texarea" value= "333" >
$ ("Input[name= ' Go"). Val ("Go to Beijing Ba");
⑤ Set the Disable property of the checkbox:
<input type= "checkbox" disabled= "Disabled" id= "Remove"/> enabled
cancel out the disabled property:
$ ("#remove"). Removeattr ("Disabled");
⑥checkbox Properties of checked:
<input type= "checkbox" disabled= "Disabled" id= "remove" value= "0" checked= ""/> enabled
if ($ ("#remove"). Val () ==1) {
$ ("#remove"). attr ("Checked", "true");
}else if ($ ("#remove"). Val () ==0) {
$ ("#remove"). Removeattr ("checked");
}
determines whether the value is selected based on its values.
⑦ Tools:
if ($.browser.msie) {
alert ("This is ie!");
}
to determine the type of browser:
Safari
Opera
Msie
Mozilla
Available values.
⑧ to cancel the start and end of a string:
$.trim(" hello, how are you? ");
jquery Basic Usage