Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check if input field has value

function check(){
  var checkInput = document.getElementById("inputName");
  if (checkInput.value) {
    checkInput.classList.remove("is-invalid");
  } else {
    checkInput.classList.add("is-invalid");
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #input #field
ADD COMMENT
Topic
Name
5+3 =