Last active
October 15, 2018 08:44
-
-
Save AndryWJ/f0422b3813118aefd221f8c864e80f54 to your computer and use it in GitHub Desktop.
JS: неактивная кнопка в зависимости от чекбокса
This file contains 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
$('.formLine-form input[type="checkbox"]').change(function(event) { | |
testCheckPolit($(this)); | |
}); | |
// Если чекбокс выбран то активируем кнопку отправки если нет деактивируем | |
function testCheckPolit(el){ | |
if(el.prop('checked')){ | |
el.closest('form').find('button, input[type="submit"]').removeAttr('disabled'); | |
}else { | |
el.closest('form').find('button, input[type="submit"]').attr('disabled', 'disabled'); | |
} | |
} | |
// css | |
button[disabled="disabled"], | |
input[disabled="disabled"]{ | |
background: #8796a6 !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment