Modern jQuery (1.7 and above) uses .on()event handlers to bind:
$(document.body).on("keyup", ":input", function(e) {
if(e.which == 13)
$(this).trigger("enter");
});
$(":input").on("keyup", function(e) {
if(e.which == 13)
$(this).trigger("enter");
});
Older versions of jQuery use one of the following methods. You can have one .live()or .delegate()an event handler for all elements. Then use this to trigger a custom event, for example:
$(document.body).delegate(":input", "keyup", function(e) {
if(e.which == 13)
$(this).trigger("enter");
});
:input , :
$("selector").bind("enter", function(){
});
.