当另一个对话框也打开时,Jquery 正在取消选择对话框中的我的单选按钮。在调试中运行,jquery 源代码中的罪魁祸首是这一行:
if ( !eventHandle ) {
elemData.handle = eventHandle = function() {
// Handle the second event of a trigger and when
// an event is called after a page has unloaded
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
undefined;//after this line executes selected radio button is lost.
};
}
有人知道为什么是这样吗?
导致此问题的简化版本:
$("#editYes").click(function(){//this radio is inside a dialog
if($("#editsList").children().size()==0){
$('#editDialogDiv').dialog('open');
setDateHints();
$('#editOpen').val("true");
}
//jquery code above runs here. Upto this point the radio remains selected
});
html是这样的:
<div title="atitle" id="dialog1">
...
Yes<input id="editYes" type="radio" value="true" name="edits"> <!-- click this to open second dialog, but its then deselected by jquery-->
No<input id="editNo" type="radio" value="false" name="edits">
...
</div>
<div title="anothertitle" id="secondDialog">
...some content
</div>