jQuery Copy Events Plugin Demos

The list below has a click event handler bound to the first list element. When you click it, it will alert "Hi!". The other two list elements do not have event handlers. If you click the button below, it will copy the events from the first list element to the last list element.

  • I have a click event bound to me
  • I do not have a click event bound to me
  • I will have the same click event as the first <li> after clicking the button

Here is the code for this demo.

jQuery(function($) {
    $('#copyEventsExampleList li:first').bind('click', function(event) {
        alert('Hi!');
    });
    $('#copyEventsToExample').bind('click', function(event) {
        $('#copyEventsExampleList li:first').copyEventsTo('#copyEventsExampleList li:last');
    });
});