我有一个按钮 Resend ,单击它,复选框会针对以下内容启用:
id="AlertSent"
id="AlertNotSent"
id="AlertInProgress"
现在上述DIVS的DIV代码如下
<div class="span9">
<div class="row-fluid">
<div id="enableCheckBox" class ="span12">
<input type="checkbox" id="checkbox1" name="checkbox1"/>
</div>
<div id="AlertSent" class="span12">
<label><spring:message code='alert.sent' />:</label>
</div>
</div>
<div class="row-fluid">
<div id="enableCheckBox" class ="span12">
<input type="checkbox" id="checkbox2" name="checkbox2"/>
</div>
<div id="AlertNotSent" class="span12">
<label><spring:message code='alert.not.sent'/>:</label>
</div>
</div>
<div class="row-fluid">
<div id="enableCheckBox" class ="span12">
<input type="checkbox" id="checkbox3" name="checkbox3" class="required" />
</div>
<div id="AlertInProgress" class="span12">
<label> <spring:message code='alert.in.progress' />:</label>
</div>
</div>
</div>
重新发送和完成的按钮代码是
<input type="button" value="button" id="resend"/>
<input type="button" value="button" id="done"/>
jQuery代码是
var j$ = jQuery.noConflict();
j$(document).ready(function() {
var resendbtn = j$('#resend');
var allChkBox = j$('input[name="enableCheckBox"]');
var verifyChecked = function() {
if ! $('#resend').click {
allChkBox.attr('disabled', 'disabled');
} else {
allChkBox.removeAttr('disabled');
}
};
verifyChecked();
resendbtn.change(verifyChecked);
});
要求是单击重新发送,复选框出现在 DIVS 上方(和) AlertSent
,并且重新发送按钮变为完成,如果用户取消选中所有复选框,则完成按钮再次变为重新发送。AlertNotSent
AlertInProgress
如何编写 JQuery/JavaScript 代码来实现上述目标?
请建议