.attr() in jQuery

It helps to get the value of an attribute for the first element in the set of matched elements.

.attr()

// To set the width attribute of an image to 400.

$(“button”).click(function(){
    $(“img”).attr(“width”,”400″);
});