Since as of jQuery 1.7, the .live() method is deprecated, I've been trying to convert one of my plugins to use on(), but I keep getting similar errors no matter what I try. The error says, "selection.value is undefined".

The old code that worked in older versions of jQuery was like this:

Code:
/* Monitor events on designated elements */
$(this)
/* Keyup and blur events necessary to handle pasted data */
.live('keyup blur', function() {
	/* If a character is being limited */
	if (this.value.search(regex) != '-1') {
		/* Remove the character from the input */
		this.value = this.value.replace(regex, '');
	}
})
/* Disable right clicks to prevent pasting via context menu */
.live('contextmenu',function () {return false});
and the new code is like this:
Code:
// Hold this in a variable for use in on()
var selection = $(this);

/* Monitor events on designated elements */
$(document)
/* Keyup and blur events necessary to handle pasted data */
.on( 'keyup blur', selection, function() {
	/* If a character is being limited */
	if (selection.value.search(regex) != '-1') {
		/* Remove the character from the input */
		selection.value = selection.value.replace(regex, '');
	}
})
/* Disable right clicks to prevent pasting via context menu */
.on( 'contextmenu', selection, function () {return false});
Why isn't selection defined? What can I do here?