I'm currently working on a jQuery homework assignment and I've been attempting to enhance the mouseover feature, but unfortunately, it's not functioning as expected.
$("button").mouseover(function() {
$(this).css({
left: (Math.random() * 300) + "px",
top: (Math.random() * 300) + "px",
}, 1);
});
button {
position: absolute;
top: 400px;
left: 500px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<h1>Catch me if you can !</h1>
<div class="main"></div>
<button>
<img src="cat/grey-cat-001.gif">
</button>
</body>