JSFiddle - React, Tailwind, and code Playground

by Qwerty_Wasd

HTML

<form action="">
  <input type="text" class="back">
  <input type="text" class="next">
</form>

JavaScript

var inp = $(':text');
$(document).on('keydown', function(e) {
  var indx = [87, 83].indexOf(e.which);
  if (inp.get().indexOf(e.target) === -1 && indx !== -1) {
    e.preventDefault();
    inp.eq(indx).focus();
  }
});