문제

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?

도움이 되었습니까?

해결책

You need to use $('#inputText').keyup(); since you want to run it when the key is released.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top