diff --git a/js/bootstrap-pincode-input.js b/js/bootstrap-pincode-input.js index 14b249d..a3721cb 100644 --- a/js/bootstrap-pincode-input.js +++ b/js/bootstrap-pincode-input.js @@ -219,7 +219,20 @@ input.on('keyup', $.proxy(function(e){ // after every keystroke we check if all inputs have a value, if yes we call complete callback - + if(!this._isTouchDevice()){ + // on backspace or delete go to previous input box + if(e.keyCode == 8 || e.keyCode == 46){ + // goto previous + $(e.currentTarget).prev().select(); + $(e.currentTarget).prev().focus(); + }else{ + if($(e.currentTarget).val()!=""){ + $(e.currentTarget).next().select(); + $(e.currentTarget).next().focus(); + } + } + } + // update original input box this.updateOriginalInput();