Removed prev and next element finding errors

This commit is contained in:
tugcekucukoglu 2024-02-22 12:19:35 +03:00
parent d05395dc54
commit e3ff6a13b0
2 changed files with 13 additions and 5 deletions

View file

@ -92,7 +92,7 @@ export default {
});
},
moveToPrev(event) {
var prevInput = this.findPrevInput(event.target);
let prevInput = this.findPrevInput(event.target);
if (prevInput) {
prevInput.focus();
@ -100,7 +100,7 @@ export default {
}
},
moveToNext(event) {
var nextInput = this.findNextInput(event.target);
let nextInput = this.findNextInput(event.target);
if (nextInput) {
nextInput.focus();
@ -108,12 +108,16 @@ export default {
}
},
findNextInput(element) {
var nextElement = element.nextElementSibling;
let nextElement = element.nextElementSibling;
if (!nextElement) return;
return nextElement.nodeName === 'INPUT' ? nextElement : this.findNextInput(nextElement);
},
findPrevInput(element) {
var prevElement = element.previousElementSibling;
let prevElement = element.previousElementSibling;
if (!prevElement) return;
return prevElement.nodeName === 'INPUT' ? prevElement : this.findPrevInput(prevElement);
},