The attr() method also allows you to set multiple attributes at the same
time.
The following example demonstrates how to set both the href and title attributes at the same time:
$("#w3s").attr({
"href" : "https://www.w3schools.com/jquery",
"title" : "W3Schools jQuery Tutorial"
});
});
The following example demonstrates how to set both the href and title attributes at the same time:
Example
$("button").click(function(){$("#w3s").attr({
"href" : "https://www.w3schools.com/jquery",
"title" : "W3Schools jQuery Tutorial"
});
});