Reputation: 3693
I want to know how to catch 'Go' pressed event using PhoneGap.
I have a form with 2 input fields. How do I catch when user has pressed "Go" in keyboard. I tried butting the input fields in a Form
and added a onSubmit
method. And in my Js I have the method.
function onLoginSubmit(e){
console.log('submit pressed');
e.preventDefault();
}
But looks like the method is never called. What is the best way of doing it? An example would be great.
Upvotes: 3
Views: 2023
Reputation: 6505
try following code:
<head>
<script language="javascript">
function show()
{
if(window.event.keyCode == 13)
{
alert(window.event.keyCode);
}
}
</script></head>
<body>
<input type="text" name="textfields" onKeyPress="show();">
</body>
Upvotes: 7