JQuery toggle problem

Posted by Mazhar Ahmed on Stack Overflow See other posts from Stack Overflow or by Mazhar Ahmed
Published on 2010-04-29T18:19:28Z Indexed on 2010/04/29 18:27 UTC
Read the original article Hit count: 391

Filed under:
|

I'm using JQuery. I'm writing this as HTML code:

<li id="toggle"> 
      <a id="open" class="open" href="#">Log In | Register</a> 
      <a id="close" class="close" style="display: none;" href="#">Close Panel</a> 
</li>

and I'm writing a code like that:

$(document).ready(function() {

        // Expand Panel
        $("#open").click(function(){
            $("div#panel").slideDown("slow");
        }); 

        // Collapse Panel
        $("#close").click(function(){
            $("div#panel").slideUp("slow");
        });     

        // Switch buttons from "Log In | Register" to "Close Panel" on click
        $("#toggle a").click(function () {
            $("#toggle a").toggle();
        });     

    });

They problem is that, it's working in a file. And after that I copied in in another file and it will not working.

There is no duplicate ID or anything else in the document

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about XHTML