javascript event onkeypress event won't run -
I am trying to warn the user whenever he presses. I decided to use javascript for this. I have the following HTML:
& lt; Div id = "all" & gt; & Lt; H1 & gt; Welcome to the awesome chat system & Lt; / H1> & Lt; Input type = "text" id = "name" & gt; & Lt; Br / & gt; & Lt; Textarea rows = '30 'id = "chatarria" disabled =' true '& gt; & Lt; / Text field & gt; & Lt; Textarea id = "written typing" onkeypress = "keyfunction (e)" & gt; & Lt; / Textarea & gt; & Lt; Button ID = "Send" & gt; Send & lt; / Button & gt; & Lt; / Div & gt;
Here is Javascript:
& lt; Script & gt; Function keyfunction (E) {if (e.keyCode == 13) {Warning ("talking to ..."); }} & Lt; / Script & gt;
However, the problem I am facing is that although I enter the texture, my browser does not alert me. I am sure I am using a browser Which supports it
Pass the function to the function:
& lt; Textarea id = "written typing" onkeyup = "keyfunction (event)" & gt; & Lt; / Textarea & gt;
Add some cross browser support:
function keyfication (e) {if (e.keycode == 13 || E.V ==13) {Warning ("Things to do ..."); }}
JS Friedal:
Comments
Post a Comment