Browse Source

atomarize functions

master
hoschi-it 2 years ago
parent
commit
bcebb0e894
  1. 21
      functions.js

21
functions.js

@ -2,13 +2,26 @@ function getInputElements(){
return document.getElementsByClassName("mask");
}
function focusNextMaskElement(){
function isMaskElementSelected(){
var focussed = document.activeElement;
return focussed.classList.contains("mask") === true;
}
function isSelectedElementLast(){
return document.activeElement.nextElementSibling === null;
}
if( focussed.classList.contains("mask") === true &&
focussed.nextElementSibling !== null
function removeActiveInputText(){
if(isMaskElementSelected()){
document.activeElement.value = "";
}
}
function focusNextMaskElement(){
if( isMaskElementSelected() &&
!isSelectedElementLast()
){
focussed.nextElementSibling.focus();
document.activeElement.nextElementSibling.focus();
}
}

Loading…
Cancel
Save