Skip to content

Instantly share code, notes, and snippets.

@thiago122
Created November 29, 2018 14:03
Show Gist options
  • Save thiago122/2fc1d362d7617ac4748087fa4f714e1a to your computer and use it in GitHub Desktop.
Save thiago122/2fc1d362d7617ac4748087fa4f714e1a to your computer and use it in GitHub Desktop.
$(function(){
var el = $('[data-accept]');
var disableEl = el.attr('data-accept-disable-id')
function toggleDisable(){
if ( el.is(':checked') ) {
$('#'+disableEl).prop('disabled', false);
} else {
$('#'+disableEl).prop('disabled', true);
}
}
toggleDisable();
$('body').on('click','[data-accept]', function(){
toggleDisable()
});
})
<input type="text" data-accept data-accept-disable-id="submit-cadastrar"> Aceitar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment