无法使用JQuery隐藏 [英] Unable to hide using JQuery

查看:129
本文介绍了无法使用JQuery隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是jQuery的新手.我正在做一个简单的示例,以隐藏示例以在单击按钮时隐藏一个段落,但某些方法无法正常工作.当我单击按钮时,该段落隐藏了不到一秒钟,并且再次可见.这是我在做什么:

Hey everyone,

I am new with jQuery. I am making a simple example to hide example to hide a paragraph on a button click, but something is not working right. When I click on the button the paragraph hides for less than a second and is visible again. Here''s what i am doing:

<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    
    <script type="text/javascript" language="javascript">
        
        $(document).ready(function () {
            $('#button').click(function () {
                $('p').hide();
            });
        });
    </script>
</head>
<body style="font-size: 62.5%;">
    <form id="form1" runat="server">
    <p>This is a paragraph</p>
    <p>This is also a paragraph</p>
    <asp:Button ID="button" runat="server" Text="Click me" />
    </form>
</body>



可能是什么原因?

谢谢
Amit



What could be the reason for that?

Thanks
Amit

推荐答案

(document).ready(function(){
(document).ready(function () {


('#button').click(function( ){
('#button').click(function () {


('p').hide(); }); }); < /script > < /head > < 正文 =" 字体大小:62.5%;" > < 表单 =" form1" runat >服务器" > < p > 段落< /p > < p > 这也是段落< /p > < asp:Button ID =" runat 服务器" 文本 点击我" / > < /form > < /body >
('p').hide(); }); }); </script> </head> <body style="font-size: 62.5%;"> <form id="form1" runat="server"> <p>This is a paragraph</p> <p>This is also a paragraph</p> <asp:Button ID="button" runat="server" Text="Click me" /> </form> </body>



可能是什么原因?

谢谢
Amit



What could be the reason for that?

Thanks
Amit


这篇关于无法使用JQuery隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆