Jquery DOM operations

Source: Internet
Author: User
1. Attribute operation 1) Search for the attribute node: the attr () method to obtain the attribute value. Its parameters can be one or more. For example: attr (& quot; title & quot;) // obtain the attribute value attr (& quot; title & quot;, & quot; aaaaaaaaa & quot;) // change the attribute value to aaaaaaaaa; 2) removeAttr () delete Method

1. Attribute operation 1) Search for the attribute node: the attr () method to obtain the attribute value. Its parameters can be one or more. For example, attr ("title ") // obtain the attribute value attr ("title", "aaaaaaaaa") // change the attribute value to aaaaaaaaa; 2) removeAttr () method to delete the element attribute;

2. Create a node: var $ lia = $ ("

  • Aaaaa
  • ")

    3. Insert node: append () directly; appendTo () append to Example. appendTo (B) means that A is appended to B, and the order is the opposite of append (); prepend () is inserted to the front of the element (opposite to after ();. prependTo (B) describes how A is inserted before B (opposite to insertAfter );

    4. Method for deleting a node: remove (). After deletion, you can continue to use these elements. For example, $ aa =$ ("ul li: eq (1)"); $ aa. remove (); $ ("ul "). append ("$ aa"); the empty () method is to clear the node; for example



    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.