Skip to content

Instantly share code, notes, and snippets.

@sobchenyuk
Last active January 17, 2018 20:42
Show Gist options
  • Save sobchenyuk/38d59995e5a03b209e8c979aa82ce0a2 to your computer and use it in GitHub Desktop.
Save sobchenyuk/38d59995e5a03b209e8c979aa82ce0a2 to your computer and use it in GitHub Desktop.
//Простая валидация проверяет пустоту полей
(()=>{
const filterForm = document.querySelector('#filter-form');
function submitFunc(e) {
let input = filterForm.querySelector('input');
if(input.value === "") {
input.classList.add('uk-form-danger');
e.preventDefault();
} else {
return true;
}
}
filterForm.addEventListener('submit', submitFunc)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment