通过JQuery隐藏服务器控件 [英] Hiding Server control through JQuery
本文介绍了通过JQuery隐藏服务器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我试图在单击服务器控件时隐藏文本框.但似乎不起作用
Hello,
I am trying to hide textbox on click of Server control. But seems like its not working
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnSubmit1").click(function () { $("#txtbox1").hide(); });
});
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>
<input id="txtbox1" type="text" />
</p>
<asp:Button ID="btnSubmit1" Text="test34" runat="server" />
</div>
</form>
</body>
</html>
有任何建议吗?
Any suggestions ?
推荐答案
(文档).ready(函数(){
(document).ready(function () {
(" span>).click(函数(){
("#btnSubmit1").click(function () {
(" #txtbox1").hide();}); }); < / 脚本 > < html =" http://www.w3.org/1999/xhtml" > < 头 =" 服务器" < 标题 > < /title > < /head > < 正文 > < 表单 =" form1" runat >服务器" > < div > < p > < 输入 =" txtbox1" 类型 文本" / > < /p > < asp:Button ID =" 文本 test34 " runat 服务器" / < /div > < /form > < /body > < /html >
("#txtbox1").hide(); }); }); </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <p> <input id="txtbox1" type="text" /> </p> <asp:Button ID="btnSubmit1" Text="test34" runat="server" /> </div> </form> </body> </html>
有什么建议吗?
Any suggestions ?
这篇关于通过JQuery隐藏服务器控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文