你的问题的工作示例:
HTML:
Same as account name
- fname
- lname
- age
- address
- city
的Javascript:
$(document).ready(function(){
var checkbox = $('#cb_ship');
checkboxStat(checkbox);
});
$('#cb_ship').click(function(){
checkboxStat($(this));
});
function checkboxStat(checkbox) {
if(!$(checkbox).is(':checked')) {
$('.ship').show();
$('.ship').find('input').prop({disabled: false});
} else {
$('.ship').hide();
$('.ship').find('input').prop({disabled: true});
}
}