use jquery to remove a onMouseover event from div

I have this div: <div class="milk full" onMouseover="init(this);rattleimage()" onMouseout="stoprattle(this);top.focus()"></div>

when someone clicks on it I want to remove the onMouseover event. Is this possible? I'm thinking something like this:

$(document).ready(function(){      
      $('.milk').click(function() {
      $('.milk').removeClass('onMouseOver');
      });
});

Thanks for any help.
LVL 4
elliottbenzleAsked:
Who is Participating?
 
HainKurtSr. System AnalystCommented:
here it is
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script>
<script>
$(document).ready(function() {
      $('.milk').click(function() {
        $('.milk').removeAttr('onMouseover');
      });
});
</script>
</head>

<body>
	
<div id=myDiv class="milk full" onMouseover="this.style.color='red'" onMouseout="this.style.color='yellow';">
when someone clicks on it I want to remove the onMouseover event. Is this possible? I'm thinking something like this:
</div>

</body>
</html>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.