A partial summary after learning jquery

Source: Internet
Author: User

1.remove and empty

<div id= "Div1" >    <ul id= "UL1" >        <li> hehe </li>    </ul></div>

$ (' #div1 '). empty (); When calling the empty method, only the child elements in the Div are cleared, and the DIV remains in the document;

$ (' #div1 '). Remove (); When you call the Remove method, the entire DIV element is removed (including itself), and all the elements inside the Div and Div are all removed from the document.

2. The difference between the 8 methods of inserting a node

Inserts a node into the interior of the specified element: Append, AppendTo, prepend, Prependto.

Inserts a node to the outside of the specified element: After, InsertAfter, before, InsertBefore.

3. Four ways to bind events

Bind, on, Live, delegate, corresponding to the function of lifting the listener are unbind, die, undelegate, off.

4. Advantages of Event Delegation

Take advantage of the principle of event bubbling.

① automatically adds events to subsequent dynamically generated elements.

The ② event is bound on an element and delegated to multiple elements, improving the performance of the program.

5.

Block bubbling: event.stoppropagation

Block default: Prevendefault

Block bubbling and default: return False

6. Coordinate values of the mouse

E.screenx (Y): The distance to the upper-left corner of the computer screen, ignoring the browser's zoom and scroll bars.

E.pagex (Y): The distance to the upper-left corner of the document, which is affected by the size of the browser and is not affected by the scroll bar.

E.clientx (Y): The distance to the upper-left corner of the browser's visible area, which is worth the size affected by the browser zoom and ScrollBar.

A partial summary after learning jquery

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.