I'm trying to alert the user whenever he/she presses enter. I decided to use javascript for this. I have the following bit of html:
<div id="all">
<h1>Welcome to the awesome chat system.</h1>
<input type="text" id="name"><br/>
<textarea rows='30' id="chatArea" disabled='true'>
</textarea>
<textarea id="writtenThing" onkeypress="keyfunction(e)"></textarea>
<button id="send">Send</button>
</div>
Here is the javascript:
<script>
function keyfunction(e)
{
if(e.keyCode == 13)
{
alert("things to do...");
}
}
</script>
However the problem that I'm facing is that even though I press enter inside the textarea my browser does not alert me. I'm sure I'm using a browser which supports this.