I want to enable textbox when checkbox is checked in jquery or javascript
function cash(cash) {
if ($(cash).is(':checked')) {
$('#cashAmount').attr("disabled", false);
} else {
alert("checkbox is not checked");
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-md-12 field-option">
<strong>Cash</strong> <input type="checkbox" name="cash" id="cash" onclick="cash(this)">
</div>
<div class="col-md-6 col-sm-6 custom_field">
<!-- custom_field -->
<span><strong>Amount <i>*</i></strong></span>
<input type="text" name="cashAmount" id="cashAmount" class="form-control" disabled>
</div>