I have a checkbox and a box. By default, the field should be disabled. Once the check box is checked, the field should turn on.
I tried literally every answer here, but no luck. I tried only css, but I couldn't either. When I try to use some samples in a violin or elsewhere, they work, but they do not in my project.
I currently have a simple test: when I click a button, the #clickerfield disables / enables. This works great. Therefore, I know my work with JavaScript, so I do not need any additional libraries. Now I just need to configure my code to work when the checkbox is checked or not.
This is what I have;
<script type="text/javascript">
$().ready(function() {
$('#clicker').click(function() {
$('#form_secondApprover').each(function() {
if ($(this).attr('disabled')) {
$(this).removeAttr('disabled');
}
else {
$(this).attr({
'disabled': 'disabled'
});
}
});
});
});