Because the main or responsible for the backend, so the front-end a lot of things are unfamiliar, jquery as the web development necessary skills, there are a lot of knowledge points, always remember not clear, so in this side to tidy up.
1. Execute after loading the page
$ (function() { // program segment })
2. Click events
$ ("#xxx"). Click (function() { // program segment })
3. Add class to the element or change class
$ ("#xxx"). AddClass ("Class1");
// Click Time to change the style $ ("#aaa"). Click (function() { $ ("#xxx"). Toggleclass ("Class1"); });
4. Assigning values to the css,html attribute of an element
$ ("#xxx"). CSS ("Display", "block");
$ ("#xxx"). HTML ("This is html<br/> the is HTML");
5. Get a jquery element
var a=$ ("#xxx"); // get the jquery object with ID xxx var b=$ (". xxx"); // Get the JQuery object class xxx
6. Get the value of an object
$ (". xxx"). Val (); // the value of the text box or drop-down box is $ (". XXX"). html (); // HTML content of the object var sex=$ ("#radio1"). Is (": Checked")? " Male ":" Female "; // the value of the Radio1 var marry=$ ("#checkbox1"). Is (": Checked")? " Married ":" Unmarried "; // The value of the check box
7. Selector
//Basic Selector$ ("#table1 tr:nth-child (even)"). AddClass ("Trodd");$("#divOne"). Val ()//element with ID divone$ (". Divone"). Val ()//class is an element of Divone$ ("div span"). Val ()//The span element under the DIV, which is separated by a space, indicates a subordinate element$ (". Class1. Class2"). Val ()//Class is the class2 element of class Class1, as above$ ("#divClass, span"). Val ()//the relationship with the ID divclass or the span element, which is either comma-represented or//Hierarchy Selector$ ("div span"). Val ();//all spans under the Div, ancestors and descendants, regardless of the layers nested, as long as the div under the span is selected$ ("Div>span"). Val ();//Div Under the first layer of span, parent-child relationship, note only the first-level span is selected. $ ("#divMid + div"). Val (); $ ("#divMid"). Next ("Div"). Val ();//Next div element with ID divmid$ ("#divMid ~ Div"). Val (); $ ("#divMid"). Nextall ("Div"). Val ();//all DIV elements after the ID is divmid$ ("#divMid"). Siblings ("Div"). Val ();//adjacent div element with ID divmid
A summary of jquery techniques