jQuery's attribute operations are very simple. The following uses an a element to illustrate the attribute acquisition/setting/deletion operations
Add attributes
$('a').attr('href', 'http://www.jquery.com')
Add multiple attributes
$('a') .attr({'href':'http://www.jquery.com', 'title':'jquery.com'})
Get attributes
$('a' ).attr('href')
class attribute
addClass()
Add a class
hasClass()
Judge Whether there is a class specified in the parameter
removeClass()
Remove a class
toggleClass()
If the class specified in the parameter already exists, If it is deleted, otherwise it will be added.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn