What is the use of attr() method in Jquery?

Answer

The attr() method sets or returns attributes and values of the selected elements.
 When this method is used to return the attribute value, it returns the value of the first matched element.
 When this method is used to set attribute values, it sets one or more attribute/value pairs for the set of matched elements.
$(selector).attr(attribute) //it will return the value of an attribute
 $(selector).attr(attribute,value) //it will set the value of an attribute
 $(selector).attr({attribute:value, attribute:value,...}) //for set multiple attribute

All JQUERY Questions

Ask your interview questions on jquery

Write Your comment or Questions if you want the answers on jquery from jquery Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---