SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    966
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Whats wrong with this simple jquery function?

    Hai folks

    slide down works charm. but slide up does not.

    Code:
    $('#bt1').click(function () {
       if(document.getElementById("drop_down_button1").style.display=="none"){  
          $('#drop_down_button1').slideDown('slow');
       }else{
           //document.getElementById("drop_down_button1").style.display="none"; 
           //// if i uncomment above line and comment blow one. then it works. 
           $('#drop_down_button1').slideUp('slow');
    	   
       }	  
    });

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,198
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Do you get any errors in your error console? I ask because the above code looks perfectly fine.

  3. #3
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    966
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris.upjohn View Post
    Do you get any errors in your error console? I ask because the above code looks perfectly fine.
    hai chris, i use firebug and it does not show any error.

  4. #4
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    966
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oops!
    all i was strugling to make a toggle display.
    just my friend suggessted to use below code and now it works
    Thanks folks

    Code:
    <script>
        $("#bt1").click(function () {
          $("#drop_down_button1").slideToggle("slow");
        });
    </script>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •