[英]Checkbox issue: Checked=“checked” not working
我的复选框有一个奇怪的问题; 在这段代码中:
<div class="two-column-layout">
<input type="checkbox" name="externalSystemEndPoint" class="hidden" />
<input type="checkbox" checked="checked" id="endPoint-{{endPointCode}}" name="externalSystemEndPoint" title="{{externalSystemName}}" value="{{endPointCode}}" {{disabledAttribute mandatory}}/>
<label for="endPoint-{{endPointCode}}" class="checkbox-label">{{externalSystemName}}</label>
</div>
即使出现第二个复选框( id="endPoint-{{endPointCode}}"
),也不会应用属性checked="checked"
的效果。
有什么提示吗?
提前致谢。
更新:这是生成的HTML代码:
<fieldset class="form-fieldset ui-corner-all">
<legend class="form-fieldset-legend ui-state-default ui-corner-all">
External Systems
</legend>
<div class="two-column-layout">
<input type="checkbox" name="externalSystemEndPoint" class="hidden">
<input type="checkbox" checked="checked" id="endPoint-CHIX_ENDPOINT" name="externalSystemEndPoint" title="Childrens Index" value="CHIX_ENDPOINT">
<label for="endPoint-CHIX_ENDPOINT" class="checkbox-label">Childrens Index</label>
</div>
<div class="two-column-layout">
<input type="checkbox" name="externalSystemEndPoint" class="hidden">
<input type="checkbox" checked="checked" id="endPoint-CIIX_ENDPOINT" name="externalSystemEndPoint" title="Citizens Index" value="CIIX_ENDPOINT">
<label for="endPoint-CIIX_ENDPOINT" class="checkbox-label">Citizens Index</label>
</div>
</fieldset>
在以下片段中,它似乎工作正常。 模板可能有问题。 如果您仍然遇到问题,请让我知道方案的详细信息
.hidden{ display: none; }
<fieldset class="form-fieldset ui-corner-all"> <legend class="form-fieldset-legend ui-state-default ui-corner-all"> External Systems </legend> <div class="two-column-layout"> <input type="checkbox" name="externalSystemEndPoint" class="hidden"> <input type="checkbox" checked="checked" id="endPoint-CHIX_ENDPOINT" name="externalSystemEndPoint" title="Childrens Index" value="CHIX_ENDPOINT"> <label for="endPoint-CHIX_ENDPOINT" class="checkbox-label">Childrens Index</label> </div> <div class="two-column-layout"> <input type="checkbox" name="externalSystemEndPoint" class="hidden"> <input type="checkbox" checked="checked" id="endPoint-CIIX_ENDPOINT" name="externalSystemEndPoint" title="Citizens Index" value="CIIX_ENDPOINT"> <label for="endPoint-CIIX_ENDPOINT" class="checkbox-label">Citizens Index</label> </div> </fieldset>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.