<html>
<head>
<title></title>
<script src="Scripts/jquery-2.1.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btn1,#btn2").click(function () {
var id = $(this).attr("id");
if (id == "btn1") {
$("#img1").attr({ "src": "images/mk2.jpg", "alt": "This is
image",
"title": "image", "style": "border:5px
red"
});
}
else if (id == "btn2") {
$("#img1").removeAttr("src
style");
}
});
});
</script>
</head>
<body>
<form id="form2" runat="server">
<div>
<input id="btn1" type="button" value="Applying
Attribute" />
<input id="btn2" type="button" value="Removing
Attribute" />
<br /><br />
<img id="img1" src="images/mk8.jpg" width="300" height="300" />
</div>
</form>
</body>
</html>
No comments:
Post a Comment