Common methods of jquery



EQ () and get ()

  • Get(): jQuery object to DOM object.

  • EQ (): jQuery object builds a new jQuery object.$(selector).eq( 0 )

Find element

  • Filter (selector) reduces the scope of matching and filters in the initial jQuery object collection$("p").filter(".selected, :first")

  • Find (selector) does not have the contents of the initial collection

  • JQuery () to return to a previous command set wrapper.

  • contents()

  • Parent (selector) finds the parent node. You can pass in expr for filtering, such as $(“span”). Parent() or $(“span”). Parent (“. Class”)

  • Parents (selector) is similar to. Parent (expr), but it looks for all ancestor elements, not only parent elements

  • Close (selector) gets the first ancestor element of the matching selector, starting from the current element up the DOM tree

  • Children (expr) returns all child nodes. This method only returns direct child nodes, not all child nodes

  • Prev() returns the previous sibling node, not all siblings

  • Prevlall() returns all previous siblings

  • Next () returns the next sibling node, not all siblings

  • Nextall() returns all subsequent siblings

  • Siblings() returns the sibling node

Styles & Properties

  • Addclass() & removeclass() add & remove class name

  • If the toggleclass() class name does not exist, the specified class name is added; if the element already has the specified class name, the specified class name is removed from the element.

  • CSS (name, value) specifies the CSS style property

  • Attrib() returns the value of attributes

  • Prop() returns the value of property


  • Event property

    • event.pageX The mouse position relative to the left edge of the document.

    • event.pageY The mouse position relative to the top edge of the document.

    • event.preventDefault () the default action to block events.

    • The DOM element that triggers the event.

    • event.type Describes the type of event.

  • Bind (eventName, CB) can customize the event

  • Unbind() removes an added event handler from the matching element

  • On (event, childselector, data, function, map) adds event handlers for current and future elements (such as new elements created by scripts)

  • Off () method

  • One() adds an event that runs only once and then removes it

  • Trigger (eventName, Param1, param2,…) param optional, additional parameters passed to the event handler, which are particularly useful for custom events.

Insert element

  • Insertafter() & after(): inserts the element from behind outside the existing element

  • Insertbefore() & before(): inserts the element from the front outside the existing element

  • Appendto() & append(): inserts the element from behind inside the existing element

  • Prependto() & prepend(): inserts the element from the front inside an existing element


  • Each() each returns the original array and does not create a new array.

  • Map () and the map method returns a new array.

Recommended Today

Digital DP-902. Number combinations up to N

Problem Description Given an array digits of digits in non-decreasing order. A number you can write with digits[i] any number of times. For example, if digits = ['1','3','5'], we can write digits like '13', '551', and '1351315'. Returns the number of positive integers that can be generated that are less than or equal to the […]