Reputation: 985
Other event types seem to work fine here - for example, mouseenter
:
$("body").delegate(".textareas", "mouseenter", myalert);
But using keyup
, or keypress
- it wont work. I didn't change anything else in my code except the event type on this line. Example:
$("body").delegate(".textareas", "keyup", myalert);
I type in a textarea, but now myalert
doesn't get called.
I'm using jquery 1.7.1.
Upvotes: 3
Views: 1510
Reputation: 985
DOMSubtreeModified
does more than I need for this, but at least it seems to notice any entered text too, so if anyone else runs into this same problem, that's what's sort of working for me until a better solution is found.
Upvotes: 0
Reputation: 9491
You can use an on to bind
$('button').click(function () {
$('body').append('<textarea>');
});
$('body').on('keyup', 'textarea', function() {
$('p').fadeIn(function(){$(this).fadeOut()});
});
Upvotes: 1