asp.net – 如果使用jQuery隐藏它,我无法点击ASP:Button?

栏目: ASP.NET · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/5276180/i-cant-click-on-an-aspbutton-if-it-is-hidden-using-jquery

我找到了StackOverFlow的答案和其他资源,说你可以点击一个隐藏的ASP:按钮与jQuery by

$("#<%=HiddenButton.ClientID%>").click();

要么

$("#<%=HiddenButton.ClientID%>").trigger("click");

但是,这些都不适用于我,除非按钮是Visible =“true”

这是按钮:

<asp:Button ID="loadCustomerContacts" runat="server" OnClick="loadCustomerContacts_Click" visible="false" />"

如果将Visible属性设置为false;通常在.net中,在处理页面后,控件不会在HTML输出中呈现.因此,就jQuery而言,该按钮不存在.

您可以在页面上执行查看源来验证这一点.

如果您想这样做,而不是使用Visible属性,您可以执行以下操作:

<asp:Button ID="myButton" runat="server" style="visibility: hidden; display: none;" />

或者你可以为它分配一个隐藏它的CSS类.

翻译自:https://stackoverflow.com/questions/5276180/i-cant-click-on-an-aspbutton-if-it-is-hidden-using-jquery


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Remote

Remote

Jason Fried、David Heinemeier Hansson / Crown Business / 2013-10-29 / CAD 26.95

The “work from home” phenomenon is thoroughly explored in this illuminating new book from bestselling 37signals founders Fried and Hansson, who point to the surging trend of employees working from hom......一起来看看 《Remote》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

MD5 加密
MD5 加密

MD5 加密工具