0
rated 0 times
[
3]
[
3]
/ answers: 1 / hits: 104624
/ 12 Years ago, thu, january 10, 2013, 12:00:00
Possible Duplicate:
Javascript capture key
I'm working on reply function using mysql and php.
My MySQL db:
reply:
rid - id;
topicid - under which topic;
uid - id of the guy who replies;
content - what did the guy said.
Here's my html code:
<form id=replyform>
<textarea name=rplcont placeholder=Press enter to submit your reply.><textarea>
</form>
My question is: How do I know if enter button is pressed?
Many thanks.
/----------------------------------------------/
here's my codes that work:
html:
<textarea id=reply name=reply onKeyPress=enterpressalert(event, this)></textarea>
js:
function enterpressalert(e, textarea){
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
alert('enter press');
}
}
and it works.
Thanks for everyone who concerns this topic!
More From » enter