Dom manipulation in jQuery jQuery animation

wrap node

Use the wrap() method to wrap a node with other tags

property manipulation

In jQuery, use the attr() method to get and set element attributes, and the removeAttr() method to remove element attributes

style manipulation

remove style

Correspondingly, use the removeClass() method to remove a certain value of the class. Its function is to remove all or the specified class from the matched elements.

Determine if there is a style

hasClass() can be used to determine whether an element contains a certain class 

Set and get HTML, text and values

text() method

The text() method is similar to the innerText property in javascript and can be used to read or set the text content in the element

val() method

This method is similar to the value attribute in javascript and can be used to set and get the value of an element

traverse nodes

The children method is
used to go to the set of matched child elements.

The children() method only considers child elements and not descendant elements

CSS manipulation

You can directly use the css() method to get and set the style properties of an element.

event binding

stop bubbling

Use the method stopPropagation() of the event object event

jQuery animation
show() method and hide() method
calling hide() method will change the element's display style to ' none '
show() method will set the element's display style to the previous display state

The parameters of the show() method and hide() method can specify the millisecond value, slowly hiding and showing

slideUp() method and slideDown() method
slideUp() method and slideDown() method only change the height of the element.
If an element's display property value is 'none', when the slideDown() method is called, the element will extend from top to bottom Show slideUp() method is just the opposite, the element will be shortened and hidden from bottom to top




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325518911&siteId=291194637