Humane React: Example 01
by kaisershahid
HTML
<form id='example-01'>
<input type="checkbox" name="enableExpiration" />
<input type="text" name="expirationDate" disabled />
</form>
JavaScript
var textbox = $("#example-01 input[name='expirationDate']");
var checkbox = $("#example-01 input[name='enableExpiration']");
checkbox.on('click', function(event) {
if (event.currentTarget.checked) {
textbox.prop('disabled', false);
} else {
textbox.val('').prop('disabled', true);
}
});