【发布时间】:2012-02-21 21:28:53
【问题描述】:
我正在使用以下代码在单击另一个按钮时触发单击事件。它在 Firefox 中运行良好。但是,在 IE 8 和 9(兼容模式)中,达到了触发事件的代码,但从未触发事件(通过写入事件日志确认)我错过了什么吗?
提前谢谢你
$('#" + cmdSaveContactDetails.ClientID + @"').click(function() {
var areasOfInterestSaveButton = $('#ctl00_TabControl_element_AreasOfInterest_element_view_AreasOfInterest_AreasOfInterest_cmdSaveAreasOfInterest');
$(areasOfInterestSaveButton).click();
});
事件处理程序:
private void cmdSaveAreasOfInterest_Click(object sender, ImageClickEventArgs e)
{
EventLog.WriteEntry("JR Saving", "");
}
【问题讨论】:
-
请贴出事件触发代码和事件处理代码..
-
在客户端检查。单击第二个按钮时使用警报。
-
你是否绑定了
$(document).ready事件中的第一个.click事件处理函数? -
执行以下工作:
__doPostBack('" + byButton.ClientID + "', '');(或者您正在获取按钮的 ID) -
@Rocket:很有可能,是的。 ASP 根据容器位置应用控件 ID(除非您使用静态 ID)
标签: javascript jquery button click