In this post, I am going to explore attributes using jQuery.

Assigning Single Attribute

$("a").attr("href", "https://nitesh.in");

Assigning Multiple Attributes


$("a").attr({
"href": "https://nitesh.in",
"title": "Nitesh",
"id": "anchorLink"
});

Capturing Attribute


var anchorLink = $("a").attr("href");
Categories: jQuery

Nitesh

Web Developer & Foodie

Leave a Reply

Your email address will not be published. Required fields are marked *