0

I am trying this link http://jsfiddle.net/QRj83/ to make it work on my phonegap app. The codes is working properly in the website but not in the phonegap app. There is no error shown and it's strange why is not working. Have someone encountered that problem in phonegap?

This is my code in js:

$('input').keyup(function(e) { if(e.keyCode == 13) { $(this).next().focus(); } });

Html code:

<input type="textbox" /> <input type="textbox" /> <input type="textbox" />

Thank you.

Gracia
  • 214
  • 1
  • 7
  • some of event is working in browser but not in device app like mouse over and all please go through some more doc and test again... – Naitik May 30 '16 at 13:31

1 Answers1

1
<!DOCTYPE html>
<html>
<body>

<input type="textbox"  id="text1" name="text1" />
<input type="textbox" id="text2" name="text2" />
<input type="textbox" id="text3" name="text3" />


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
var name="text";
var count=3;

$( document ).ready(function() {
   setIndex();
});


function setIndex() {
 for(var i=1;i<=count;i++)
 {
  document.getElementById(name+i).tabIndex = i;
  document.getElementById(name+i).onkeypress = function(event) {
        myFunction(event);
    }
 }
}

function myFunction(event) {
    var x = event.which || event.keyCode;
 if(x==13)
 {
  var item=event.target.id;
  var tabIndex=parseInt(item.replace(name,""));
  if(tabIndex==count)
  {
   document.getElementById(name+1).focus();
  }
  else
  {
   tabIndex=tabIndex+1;
   document.getElementById(name+tabIndex).focus();
  }
 }
}
</script>

</body>
</html>
Alper Şaldırak
  • 1,034
  • 8
  • 10