I'm going through a book on Jquery, came across an exercise, but it's not working, checked some related problems on stackoverflow and crosschecked with what I've done so far, it's almost the same but mine is not working, can someone please profer a solution? Here is the code:
<form action="#">
Billing Address same as Shipping Address:
<input type="checkbox" name="billingAddress" id="billingAddress" />
<br />
<br />
Street Address:
<input class="baddr" type="text" name="street" id="street" />
<br />
<br />
City:
<input class="baddr" type="text" name="city" id="city" />
</form>
<script type="text/jscript">
$(document).ready(function() {
$("#billingAddress").click(function() {
if ($("#billingAddress").attr("checked") == true) {
alert("Id billingAddress is checked!");
$(".baddr").val("");
$(".baddr").attr('disabled', 'disabled');
} else if ($("#billingAddress").attr("checked") == undefined) {
$(".baddr").removeAttr("disabled");
}
});
});
</script>