mehnihma 0 Junior Poster

I found this code:

<script src=""></script>
function enterAsTab() {
  var keyPressed = event.keyCode; // get the Key that is pressed
  if (keyPressed == 13)
    //case the KeyPressed is the [Enter]
    var inputs = $('input'); // storage a array of Inputs
    var a = inputs.index(document.activeElement); 
    //get the Index of Active Element Input inside the Inputs(array)

    if (inputs[a + 1] !== null)
      // case the next index of array is not null
      var nextBox = inputs[a + 1]; 
      nextBox.focus(); // Focus the next input element. Make him an Active Element

    return false;

  else {return keyPressed;}

It works but on some fileds, like on chekboxes it does not, tab normaly works.

Do you know maybe how to adopt this script to make it work on all fileds?