0
我希望「EnterTemplate」div
基於單選按鈕有條件可用。爲了測試的目的,我在底部添加了text
數據綁定,並根據單選按鈕值向我返回「true」或「false」值。我試圖分配visible
綁定這個值,但沒有任何事情發生。有什麼建議麼?可見綁定不能與單選按鈕組合使用
<div><h4>Select Instrument Template:</h4></div>
<div id="ChooseModel">
<strong>Would you like to manually insert number?</strong><br />
<input type="radio" name="ChooseModel" value="True" data-bind="checked: RadioOption"/>@Resx.Yes
<input type="radio" name="ChooseModel" value="False" data-bind="checked: RadioOption"/>@Resx.No
</div>
<div id="EnterTemplate" data-bind="visible: RadioOption">
<div><strong>Model Number: </strong></div>
<div><input data-bind="value: ModelNumberString" /></div>
<div><strong>Manufacturer: </strong></div>
<div><input data-bind="value: ManufacturerString" /></div>
<div>Model Number: <strong data-bind="text: ModelNumberString"></strong></div>
<div>Checked: <strong data-bind="text: RadioOption"></strong></div>
</div>
[在Knockout JS中綁定真/假單選按鈕]可能的重複(http://stackoverflow.com/questions/10127001/binding-true-false-to-radio-buttons-in-knockout-js) – Jeroen