Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

20 righe
574 B

  1. (function($) {
  2. $.enterfocus = function(selector, callback) {
  3. var boxArray = [].slice.call(document.querySelectorAll(selector));
  4. for (var index in boxArray) {
  5. var box = boxArray[index];
  6. box.addEventListener('keyup', function(event) {
  7. if (event.keyCode == 13) {
  8. var boxIndex = boxArray.indexOf(this);
  9. if (boxIndex == boxArray.length - 1) {
  10. if (callback) callback();
  11. } else {
  12. //console.log(boxIndex);
  13. var nextBox = boxArray[++boxIndex];
  14. nextBox.focus();
  15. }
  16. }
  17. }, false);
  18. }
  19. };
  20. }(window.mui = window.mui || {}));