♦ jQuery set attr()
♣ Example4: jQuery set attr()
Sets the Attribute content of selected HTML element from selected attribute.Basic Syntax
$(selector).attr("attribute_data");
selector: the HTML element to be selected
attr(): syntax for assigning value to attribute of selected HTML element.
attribute_data: content for href of HTML tag.
In this example, jQuery set attr() method is illustrated.attr(): syntax for assigning value to attribute of selected HTML element.
attribute_data: content for href of HTML tag.
Example
Input:
Output: