Sharp Jquery-dom operation

Source: Internet
Author: User

1 Find node ① the node lookup ② is available based on the jquery selector. Text () Gets the text content of the node ③ available. attr ("attr") gets the property value2 create node ① the jquery factory function is available to complete the $ (HTML) eg:$ ("<li ></li> ") You can add text and attributes to the label at the same time  3 Insert node ① method (see document) The  ② method not only inserts the node but also moves the node 4 delete node ①remove () removes all matching elements ② Detach () also removes all matching elements, unlike remove, which retains sample data, and all of its bound events and additional data are preserved ③empty () empties the node, emptying all descendant nodes of the matching element including the content 5 replication node ① Clone (true) copies the matching nodes; True indicates that the binding event of the element is copied at the same time 6 replacement node ①replacewith () Eg:a.replacewith (b) b replaces A②replaceall () with ReplaceWith ( Replace with the replaced Node 7 parcel node ① wrap node A.wrap ("<b></b>") with <b> label to wrap a together if A is a multi-node object, provide a <b> label package for each node A.wrapall ( "<b></b>") if A is a multi-node object, provide a label for the object, wrapping all nodes in a B tag  a.wrapinner ("<b></b>") Provides a <b> tag 8 property operation for matching the contents of each node of the label object ① gets and sets the property a.attr ("title"); A.attr ("title", "value") ② Delete attribute a.removeattr ("title"), 9-style operation ① get and set style (Operation Class property) E.attr ("class"); E.attr ("Class", "value"),  ② append style addclass ("ClassName") appends a Classname③ remove style removeclass ("ClassName" Removes a Classname④ toggle style. Toggleclass ("ClassName") if the style is removed from the class, if not, add the Clss⑤ to determine if a style is included. HasclaThe SS ("ClassName") determines whether a class;10 setting is included and gets the HTML, text and value 1. HTML () method similar to the innerHTML method in JS, set and get HTML content in the element 2. Text () The method is similar to the InnerText method in JS, which sets and gets the text value in the element 3. The Val () method sets and gets the value property in the element, or if the element is multiple, returns an array of 11 matching nodes to find ①.children () to find all the child nodes of the matching node; Only child nodes are considered, regardless of descendant other nodes) ②.next ()/.prev ()/siblings () finds adjacent sibling elements that match the node (rear/front/all); ③.parent ()/.parents () finds the parent element of the matching node  12 Css-dom operation ① gets/sets the style value $ ("E"). CSS ("Cssattr") $ ("E"). CSS ("cssattr", "value"), ②.offset ()/.position () are all get left/ Top value offset Gets or sets the value relative to the window position Gets or sets the value of the ancestor element relative to the first absolute or relative positioning ③.scrolltop ()/.scrollleft () Gets or sets the distance from the top or left end of the scrollbar

Sharp Jquery-dom Action

Related Article

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.