"Learning Notes" sharp jquery (ii) DOM manipulation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.