Reputation: 597
I need some help with making the following code work properly:
$('#entry').keydown(function(e) {
alert(e.keyCode);
});
With this textarea field:
<textarea id="entry" placeholder="Type message here"></textarea>
I have checked with adding alerts outside of the brackets, and the document is loaded and works fine. I even extract a series of entries from a database right after this, with no errors.
What I'm looking to cook here is a textfield that when pressing Enter simply sends the .val()
of the field to another function responsible for the AJAX request. But obviously I can't get there when I cannot enter the function.
Upvotes: 0
Views: 483
Reputation: 7569
Try:
$('#entry').live('keydown',function(e) {
alert(e.keyCode);
});
Upvotes: 1