如何在jquery方法中使用class或id [英] how to use class or id in the method of jquery

查看:82
本文介绍了如何在jquery方法中使用class或id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了以下代码



i wrote following code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
    <script type="text/javascript">

   $(document).ready(function () {
            $("button").click(function () {
                $("#test").hide();
            });
        });
<body>
<p class="test">This is another paragraph.</p>
 <asp:Button ID="button"  runat="server" Text="click" />
</body>




运行时
当我点击按钮这是另一段应该隐藏时,我没有得到输出。

请告诉



on runtime i am not getting output when i click button "This is another paragraph" should hide.
pls tell

推荐答案

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


(button)。 click(function(){
("button").click(function () {


(#test)。hide();
});
});
< body >
< p class = test > 这是另一段。< / p >
< asp:Button ID = button runat = server 文字 = 点击 / >
< / body >
("#test").hide(); }); }); <body> <p class="test">This is another paragraph.</p> <asp:Button ID="button" runat="server" Text="click" /> </body>




运行时
当我点击按钮这是另一段应该隐藏时,我没有得到输出。

请告诉



on runtime i am not getting output when i click button "This is another paragraph" should hide.
pls tell


这篇关于如何在jquery方法中使用class或id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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