Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophia Wild committed Apr 18, 2024
1 parent cc8a9c2 commit 7c350a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions content-elements/advanced/form-pin/form-pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Alpine.data('formPin', () => ({
_autoFocusNextPinInput() {
var inputPin = this.$el;
var inputWrapper = inputPin.parentNode.nextElementSibling;
if (inputPin.value && this._LastPinElement()!=null) {
if (inputPin.value && !this._LastPinElement()) {
var nextPinInput = inputWrapper.children[1];
while (nextPinInput) {
var pinInput = nextPinInput;
Expand All @@ -73,7 +73,7 @@ Alpine.data('formPin', () => ({
_cleanUp() {
var inputPin = this.$el;
if (inputPin.value) {
if (this._LastPinElement() == null){
if (this._LastPinElement()){
inputPin.value = inputPin.value.slice(-1);
}
if (inputPin.value.length > 1) {
Expand All @@ -94,6 +94,10 @@ Alpine.data('formPin', () => ({

_LastPinElement() {
var inputPin = this.$el;
return inputPin.parentNode.nextElementSibling;
if(inputPin.parentNode.nextElementSibling == null){
return true;
} else {
return false;
} ;
},
}));

0 comments on commit 7c350a2

Please sign in to comment.