用淘汰赛清除单选按钮

时间:2013-04-29 15:05:05

标签: knockout.js

当选择'禁用内容'时,我需要清除(无选择)我的前2个单选按钮(CMR conv + Out of CMR)。

淘汰赛有可能吗?

我已经禁用了它们,但我也需要清除它们。

jsFiddle:http://jsfiddle.net/mnucj/

CMR convention: <input type="radio" name="cmrConvention" value="true" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false">
<br/>
Out of CMR convention: <input type="radio" name="cmrConvention" value="false" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false">
<br/>
- - - - - -
<br/>
Enable things: <input type="radio" name="thirdParty" value="false" data-bind="checkedRadioToBool: thirdPartyInsured">
<br/>
Disable things: <input type="radio" name="thirdParty" value="true" data-bind="checkedRadioToBool: thirdPartyInsured">

感谢。

1 个答案:

答案 0 :(得分:0)

单击“禁用内容”复选框时,可以使用单击绑定,如下所示:

Disable things: 
<input type="radio" name="thirdParty" value="true" 
       data-bind="checkedRadioToBool: thirdPartyInsured, 
                  click: function() { cmrConvention(null); return true; }">

请参阅updated fiddle