Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //4. Валидация всех форм
- const editButton = document.forms.editform.elements.savebutton;
- const editForm = document.forms.editform;
- const editingName = document.forms.editform.elements.username;
- const editingFormInfo = document.forms.editform.elements.userinfo;
- function activationOfEditingButton () {
- if (editingName.value.length === 0 || editingFormInfo.value.length === 0 ) {
- editButton.setAttribute('disabled', true);
- editButton.classList.remove('button_active');
- } else {
- editButton.removeAttribute('disabled');
- editButton.classList.add('button_active');
- }
- }
- editForm.addEventListener("input", activationOfButton);
- //с использованием параметров
- function activationOfEditingButton (firstinput, secondinput, submit) {
- if (firstinput.value.length === 0 || secondinput.value.length === 0 ) {
- submit.setAttribute('disabled', true);
- submit.classList.remove('button_active');
- } else {
- submit.removeAttribute('disabled');
- submit.classList.add('button_active');
- }
- }
- editForm.addEventListener("input", activationOfButton(editingName, editingFormInfo, editButton));
- Coll
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement