The .on()
method isn't going to work in your fiddle at all because you have specified an old version of jQuery from before .on()
was introduced.
If you upgrade to a newer version of jQuery (at least 1.7) you can do this:
$(document).on('keyup', '.trans', function() {
alert("Working");
});
Demo: http://jsfiddle.net/VFt6X/4/
If you need to keep using v1.6.4 for some reason then use the .delegate()
method instead:
$(document).delegate('.trans', 'keyup', function() {
alert("Working");
});
Demo: http://jsfiddle.net/VFt6X/5/
Note that either way the '.trans'
selector for the elements you care about is passed as a parameter to the function. The $(...)
part on the left has to specify some container that already exists. I've used document
, but it is better to specify something closer to the elements in question if possible, so in your case you could use $("#centerNotes")
.