Reputation: 197
What is the purpose of using the (evt)
here? It seems to work just fine with leaving it empty, like highlight()
. Also, the alert doesn't include anything.
<script>
$(function (){
$("#height").html($("#theDiv").height());
$("#theDiv").on("mouseover mouseleave", highlight);
});
function highlight(evt) {
$("#theDiv").toggleClass("change");
alert(evt);
};
</script>
Upvotes: 0
Views: 2539
Reputation: 8189
evt is an argument that gets passed to the function by the browser automatically.
It simply contains information about the mouseover or mouseleave event.
Things like where it happened, what element it occured on, etc.
You can choose to use it or just remove it from the callback if you're not planning to use it.
Read more here... https://developer.mozilla.org/en-US/docs/Web/API/Event
Upvotes: 1