First, get the DOM node
// Find Ancestors // find descendants children (); Find (); // Find Brother Next ()/Nextall () prev ()/Prevall () siblings ()
Second, Element node operation
$ (HTML)//Create DomAppend ()/appendto ()//Internal AppendPrepend ()/prependto ()//internal front-facingAfter ()/insertafter ()//Back InsertBefore ()/insertbefore ()//Front Insert (note the insertbefore that distinguishes JS)replacewith ()/replaceall ()//Replace nodeWrap ()//Individual PackagesWrapall ()//Overall PackageWrapinner ()//Internal Package two ways to delete nodes remove ()//can still be appended, but the bound event is invalidatedDetach ()//preserving node-matching events and methods other clone ()/clone (true)//True indicates that a copy of the element also has copy functionalityEmpty ()//empties all descendant nodes of an element
Third, attribute node operation
//Getattr"title") //Setattr"title","Test") attr ({"title":"Test","name":"Hello" )}//DeleteRemoveattr ()
Four, style operation
//class operation, multiple class names can be manipulated concurrentlyaddclass () removeclass () Toggleclass () hasclass ( )//returns a Boolean value equivalent to IS (". ClassName")//css-dom operation, but appears in the presentation layer, using class insteadCSS ()//usage with attr (), quoted, "-" with hump-type replacementcss"Opacity","0~1")//Set Transparencyheight ()/width () height ( -)/height ("10em")//default unit pxoffset (). Left/top position (). Left/topscrolltop ()/scrollleft ()//distance from top and left of scroll bar
V. Getting and setting HTML, text, and values
// no parameters are obtained, parameters are set to parameter values html () text () // the text value of the element Val () // Current default value obtained with DefaultValue
"Learning Notes" sharp jquery (ii) DOM manipulation