tags:

views:

58

answers:

4
+1  Q: 

JQuery selector

$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').hide();
    });
});

In the above code snippet, suppose I want to add both the code

  1. for show() function to show the content and
  2. for hide() function to hide the content.

is it possible?

+4  A: 
$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').toggle();
    });
});
Eric
A: 

Use:

$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').toggle();
    });
});

See: http://api.jquery.com/toggle/#toggle2

Sheriff Md
A: 

try

$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').toggle();
    });
});
choise
+1  A: 
$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').toggle();
           //http://www.learningjquery.com/2006/09/slicker-show-and-hide
         or 
         $('#disclaimer,#clock').slideToggle("slow");
         //http://api.jquery.com/slideToggle/
    });
});
Pranay Rana
ya this is working.thanks buddy!
picnic4u
when i add toggling on div element then it's not working y?
picnic4u
i have to check for that its working for me will get back to you if find solid reason for this
Pranay Rana
ok,bcoz it's not working here
picnic4u
hi! pranay, i had done some mistake in id. that's y it's not working. now it's working.
picnic4u