I have some elements with a function bound to the click event. I want to bind that same function instead to the mouseover and mouseout eve
In jQuery, all the events bound by jQuery are stored in data under the key events. The following would do what you want:
var $this = $(this),
events = $this.data('events');
if( events && events['click'] ){
// Loop through each click event bound to this control
$.each( events['click'], function(){
// this = the function
$this.bind('mouseover mouseout', this);
});
// Finally, remove all `click` handlers with one call
$this.unbind('click');
}