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


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

查看所有标签

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

High Performance Python

High Performance Python

Andrew Lewis / O'Reilly Media, Inc. / 2010-09-15 / USD 34.99

Chapter 1. Introduction Section 1.1. The High Performance Buzz-word Chapter 2. The Theory of Computation Section 2.1. Introduction Section 2.2. Problems Section 2.3. Models of Computati......一起来看看 《High Performance Python》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具