I'm using knockout and I have 2 radio buttons, when a particular one is selected I need a textbox to be enabled and disabled if the other option is selected. 我似乎无法让这个工作。这是我到目前为止所拥有的:IssercentageBased 是我的视图模型上的布尔值,我已将其设置为可观察的。有任何想法吗?
<input type="radio" name="IsPercentageBased" value="true" data-bind="checked: IsPercentageBased"/>
<span>Percentage</span>
<input type="radio" name="IsPercentageBased" value="false" data-bind="checked: IsPercentageBased"/>
<span>Value</span>
@Html.TextBox("Value", "", new
{
type = "text",
data_bind = "value: Value, valueUpdate: 'afterkeydown', disable: IsPercentageBased"
})