Search
Close this search box.
Search
Close this search box.

jQuery events

var handler = function() {
  alert('The quick brown fox jumps over the lazy dog.');
};
$('#orange').bind('click', handler);
$('#orange').unbind('click', handler);

Passing Data to Event Handlers

var theData = "My data";
var handler = function(event) {
  console.log(event.data);
};
$("#some-element").bind("click", theData, handler);

Hovering

$('.my_div').hover(hover_previous_in, hover_previous_out);

function hover_previous_in() {
    console.log('in');
}

function hover_previous_out() {
    console.log('out');
}

Learning Resources