Last active
August 29, 2015 14:25
-
-
Save bitboxx/37bbcefc66e5eafca263 to your computer and use it in GitHub Desktop.
jQuery live() and die() plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery live() and die() plugin for newer version jQuery (version newer than 1.7) | |
// meant to facilitate gradual upgrade of old jQuery code to a newer version | |
jQuery.fn.live = function (eventTypes, eventHandler) { | |
var that = $(this); | |
$(document).on(eventTypes, that['selector'], eventHandler); | |
return that; | |
}; | |
jQuery.fn.die = function (eventTypes, eventHandler) { | |
var that = $(this); | |
$(document).off(eventTypes, that['selector'], eventHandler); | |
return that; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment