<!DOCTYPE html>
<html>
<head>
<title>jQuery attr() function</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
$("button").click(function(){
$("p").attr({style:"text-align: center", title: "First paragraph"});
});
});
</script>
</head>
<body>
<div>
<p>Heading</p>
<button>Set attribute value</button>
</div>
</body>
</html>