Console. info ($("#div1"). text ());
Console. info ($("#div1").length);
Console. Debug ($("Div").length);
Console. Debug ("-----------------------------------------------------------------------------------------");
/*get ipput Parallel div layer */
Console. Debug ($("input,Div"). text ());
Console. Debug ("-----------------------------------------------------------------------------------------");
/*get div Parallel input layer */
Console. Debug ("-----------------------------------------------------------------------------------------");
Console. Debug ($("Div>input"). text ());
Console. Debug ("-----------------------------------------------------------------------------------------");
/*match all elements of input immediately behind the div */
Console. Debug ($("Div+input").length);
Console. Debug ($("Div+input"). text ());
Console. Debug ("-----------------------------------------------------------------------------------------");
/*match all elements of input after DIV */
Console. Debug ($("Div~input").length);
Console. Debug ($("Div~input"). text ());
/ * jquerygets a value-related method that returns the value of the first element if it is manipulated against multiple elements;
jquery sets a value-related method that, if operated on multiple elements, sets all element values; */
/* Set CSS style */
$("#div1"). CSS ("Color","Red"). CSS ("FontSize","30px");
/*Append String */
$("#div1"). CSS ("Color","Red"). CSS ("FontSize","30px"). Append ("strong Chun Dream ");
/*add content to all string matching tags */
$("Div Div"). Append ("Xxxxxxxxxxxxxxxxxxx");
/*add sibling tags after matching elements */
$("Div Div"). After ("<p>1233123131231313131312331231313131311313131</p>");
/*add sibling tags before matching elements */
$("Div Div"). Before ("<p style= ' color:red ' >1111111111111111111111111111111111111111</p>");
/*Insert the matched element into a layer */
$("Div Div").InsertBefore($("#div1"));
/*
* Delete
Empty (): Deletes all child nodes of the matching element.
Remove ([jquery selector]) removes all matching elements:D om.
* */
/* Delete all child nodes */
$("Div Div"). empty ();
/*Delete the matching element */
$("Div Div"). Remove ();
/*Replace */
$("Div Div"). ReplaceWith ("<p style= ' Color:green ' >QQQQQQQQQQQQQQQQQQQQQQQ</P>");
/*Clone */
/*
* Clone () clones the matching DOM elements and selects copies of those clones.
The Clone (true) element handles all of its events and selects copies of those clones
* */
/*$ ("P"). Clone (True). Append (document.body);
/* Property Action checked*/
/$("#btn"). Click (function() {
Alert"312");
});
Console. Debug ($("#div1. S1").length);
/*gets the div layer under the class selector for the layer that is S1, and for the specified layer, and displays the contents of the layer */
Console. Debug ($("#div1. S1"). Get (1).InnerHTML);
Console. Debug ("------------------------------------");
Console. Debug ($("#div1. S1"). Get (1).InnerText);
Console. Debug ("------------------------------------");
/*Print all of the matching layers */
varStr=$("#div1. S1");
for(varI=0;i<str.length; i++) {
Console. Debug ($("#div1. S1"). Get (i).InnerText);
}
/*change the properties of all layer content to match */
$("#div1. S1"). CSS ("Color","Red");
Console. Debug ("------------------------------------");
/*change the properties of the specified matching element */
Console. Debug ($("#div1. S1"). Get (2).InnerHTML);
$("*") |
Select all elements |
$ (This) |
Select the current HTML Elements |
$ ("P.intro") |
Select class to be Intro of the <p> Elements |
$ ("P:first") |
pick the first one <p> Elements |
$ ("ul Li:first") |
pick the first one <ul> element of the first <li> Elements |
$ ("ul Li:first-child") |
Select each <ul> element of the first <li> Elements |
$ ("[href]") |
Select with href element of the property |
$ ("a[target= ' _blank ')") |
Select All Target property value equals "_blank" of the <a> Elements |
$ ("a[target!= ' _blank ')") |
Select All Target property value is not equal to "_blank" of the <a> Elements |
$ (": Button") |
Select All type= "button" of the <input> Elements and the <button> Elements |
$ ("Tr:even") |
Select an even position <tr> Elements |
$ ("tr:odd") |
Select the odd position of the <tr> Elements |
$ (document). Ready (): allows us to execute functions after the document is fully loaded
Click (): A function is called when a button click event is triggered
DblClick (): DblClick event occurs when an element is double-clicked
MouseEnter (): MouseEnter event occurs when the mouse pointer crosses an element
MouseLeave (): MouseLeave event occurs when the mouse pointer leaves an element
MouseDown (): MouseDown event occurs when the mouse pointer moves over the element and the mouse button is pressed
Hover (): Used to simulate cursor hover events
Focus (): The focus event occurs when the element gets the focal point
Blur (): Blur event occurs when the element loses focus
jquery Basic Operations