Reputation: 37
Didn't know how to word this better and couldn't find an answer through some searches.
I'm just wondering if I can replace: $("#someid").hover(function() {});
with my own function in place such as: $("#someid").hover(myfunction() {});
This has probably been answered and I'm just terrible at searching but any help would be greatly appreciated. Thanks
Upvotes: 0
Views: 39
Reputation: 36642
Sure you can...
$('#someID').hover(myFunc);
function myFunc() {
$('#someID').css('color','red');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="someID">HOVER ME</div>
Upvotes: 4