jquey功能不起作用 [英] jquey functions is not working
本文介绍了jquey功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i是jquery的新手,我已经编写了这个简单的jquery函数,但是它没有工作,我已经下载了最新的jquery版本并保存在jquery文件夹下的根目录下。 。
< script type = text / javascript src = jquery / jQueryv1.9.1.js > < / script >
< script type = text / javascript >
$(document).ready(function(){
('#toview')。click(function(){
('#sub')。hide( );
});
});
< / script >
< a < span class =code-attribute> id = toview href = # > 点击隐藏 < / a >
< br / >
< ASP:拉bel ID = Label1 runat = server 文字 = 标签 > < / asp:Label >
< div id = sub > < asp:Button ID = Button1 runat = 服务器 正文 = 按钮 OnClick = Button1_Click / > < / div >
help please
解决方案
(document).ready(function(){
('#toview')。click(function(){
('#sub ')。隐藏();
});
});
< / script >
< a < span class =code-attribute> id = toview href = # > 点击隐藏 < / a >
< br / >
< ASP:拉bel ID = Label1 runat = server 文字 = 标签 > < / asp:Label >
< div id = sub > < asp:Button ID = Button1 runat = 服务器 正文 = 按钮 OnClick = Button1_Click / > < / div >
help please
您缺少
符号(或jQuery
)之前(''#查看'')和(''#sub'')。只需添加它就可以了。
所以你的代码将是:
hello,
i am new for jquery, i have written this simple jquery function but its not working, i have downloaded the latest jquery version and saved in root directory under jquery folder..
<script type="text/javascript" src="jquery/jQueryv1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
('#toview').click(function(){
('#sub').hide();
});
});
</script>
<a id="toview" href="#">click to hide</a>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<div id="sub"><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/></div>
help please
解决方案
(document).ready(function(){ ('#toview').click(function(){ ('#sub').hide(); }); }); </script> <a id="toview" href="#">click to hide</a> <br /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <div id="sub"><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/></div> help please
You are missing the
sign (orjQuery
) before (''#toview'') and (''#sub''). Just add it and it will be fine.
So your code will be:
这篇关于jquey功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文