我正在尝试使用标签构建一个单选按钮列表,以便您可以单击标签来检查单选项.我在Chrome中运行得很好,但不是IE7.得到吐出的
HTML似乎是正确的,但当我点击标签时,相应的单选按钮不会被选中.
function ReuqestType(id,name,billable) { this.id = id; this.name = name; this.billable = billable; } function Requestviewmodel() { var self = this; self.availableRequestTypes = [ new ReuqestType(1,"Travel",true),new ReuqestType(2,"Bill Only",false),new ReuqestType(3,"Both",true) ]; self.selectedRequestType = ko.observable(); }
HTML
Request Type <br /> <!-- ko foreach: availableRequestTypes --> <input type="radio" name="requestType" data-bind="value:id,attr: {'id': 'rt'+ id}" /> <label data-bind="text: name,attr:{'for':'rt'+id}"> </label> <!-- /ko -->
这样做的首选方法是什么?
@H_403_12@