$(document).ready(function () { $("#myDiv").hover(function () { $(this).addClass("thisDiv"); }); $("#reset").click(function () { location.reload(); }); });
<html> <head> <title>addClass</title> </head> <body> <span id="myDiv"> Hover Me </span> <br /> <input type="reset" id="reset" value="Reset" /> </body> </html>
.thisDiv { background-color:Red; margin-left:400px; width:200px; height:200px; display:block; }