1. Selector
In HTML, we can use web effects to select an HTML tag to operate, such as modifying the attributes of HTML tags, adding a class attribute, and so on. Using jquery to select an HTML tag is easier
1 Select an HTML tag through the ID attribute of the HTML
var id = jquery ("#id3");
Id.html ("hahaha");
<div id= "ID3" ></div>
The above code gets a div tag and assigns hahaha to the contents of the tag, because the tag ID equals ID3
2) by element name selection
var ids = jquery ("div");
alert (IDs);
///////////////////////
<div>aa</div>
<div>bb</div>
The above code gets an array of elements in the array that are 2 div tags
3 Select elements through the class attribute of the element
4 through the * can select all elements
5 Select elements through element child elements
For example:
jquery ("Div li"); Get the Li child element below the DIV element
jquery ("Div li:has (a)"); Gets the Li child element below the div element, and these child elements are child elements with <a> tags, such as:<div><li><a>aa</a></li><li> </li></div> only to the first Li
jquery ("Div:eq (0)"); Get the first DIV element
jquery ("Div:lt (2)" >;//Get top two div
jquery ("div:last (0)"); Get the Post div
2. Remove first space
var s = Jquery.trim ("SSS");
3. The role of window.onload = Mybegin is to execute the Mybegin function when the document is loaded, but this sentence can only be written once, and if you want to perform multiple functions, use jquery:
jquery (document). Ready (function () {});
This sentence can also be written as: jquery (function () {});