Reputation: 61
I have a textarea
<textarea id='inputText' rows='30' style="width: 45%; margin-left: 20%;">
and in Javascript when I press a key a send the value of the textare
$('#inputText').keypress(function (e){
conn.send($('#inputText').val());
}
my problem is that when I press a key it sends the previous state of the textare. Is there a way where I can "refresh" the textarea value before sending it?
Upvotes: 0
Views: 94
Reputation: 839
You need to use $('#inputText').keyup();
since you want to run it when the key is released.
Upvotes: 3