我写了这段代码。但它适用于 html 复选框和 txtbox。我想用 asp.net txtbox 和 checkbox.how 做同样的功能?
<script type="text/javascript">
$(document).ready(function() {
var checkbox = $('#notify');
var textfield = $('#notifyemailaddress');
checkbox.click(function() {
if (checkbox.is(':checked')) {
textfield.removeAttr("disabled");
textfield.removeClass("email");
}
else {
textfield.attr("disabled", "disabled");
textfield.addClass("email");
}
});
});
</script>
<div>
<input type="checkbox" id="notify"/>
<label for="notify">Notify</label>
<input type="text" id="notifyemailaddress" disabled="disabled" class="email" style="width:25%" />
</div>