Last active
January 17, 2018 20:42
-
-
Save sobchenyuk/38d59995e5a03b209e8c979aa82ce0a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Простая валидация проверяет пустоту полей | |
(()=>{ | |
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