This article mainly introduces the usage of tag element attributes used by jQuery. The example shows how jQuery controls the page, this section describes how to use attributes of elements, css styles, DOM models, form elements, and Event Processing. For more information, see the following example. Share it with you for your reference. The specific analysis is as follows:
This section describes how to use jQuery to control pages, including attributes of elements, css styles, DOM models, form elements, and event processing.
Tag element attributes
Each tag in html has some attributes, and the tag shows various states in the page, such as the following tag
The code is as follows:
This tag indicates the name of the tag. it is a hyperlink. In addition, attributes such as href titile target id indicate the status of the hyperlink on the page.
This article explains how to control page attributes from the jQuery perspective.
1. each () traversal element
The each (callback) method is mainly used to traverse the elements in the selector. it accepts a function as a parameter. this function accepts a parameter to indicate the sequence number of the element. For tagged attributes, you can use the each () method with the this keyword to obtain or set the attribute values corresponding to each element in the selector.
Use the each () method to traverse all elements.
The code is as follows: