<html>
<head>
<script src="../../ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#w3s").attr({
"href" : "https://www.w3schools.com/jquery/",
"title" : "W3Schools jQuery Tutorial"
});
});
});
</script>
</head>
<body>
<p><a href="../index.html" title="some title" id="w3s">W3Schools.com</a></p>
<button>Change href and title</button>
<p>Mouse over the link to see that the href attribute has changed and a title attribute is set.</p>
</body>
<!-- Mirrored from www.w3schools.com/jquery/tryit.asp?filename=tryjquery_dom_attr_set2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:28:22 GMT -->
</html>