更新时间:1970-01-01 07:58:36
来自 点击
事件文档:
From the click
event documentation:
默认情况下,Knockout会阻止
点击
事件采取任何默认操作。
...
但是,如果你想让默认的点击
操作继续,只需从你的点击处理程序返回true
函数。
By default, Knockout will prevent the
click
event from taking any default action.
...
However, if you do want to let the defaultclick
action proceed, justreturn true
from your click handler function.
因为你的点击
处理程序而你的单选按钮被重置了修复它你只需最后返回true
:
So your radio button is reset because of your click
handler and to fix it you just need to return true
at the end:
click: function(){
alert('Hi');
return true;
}
演示 JSFiddle 。