1
$(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?

5
  • You mean, toggling between show and hide?
    – Pekka
    May 27, 2010 at 11:32
  • You want to show and hide the content at the same time? May 27, 2010 at 11:32
  • as le chiffre says in casino royale: why not?
    – miku
    May 27, 2010 at 11:33
  • @Felix: Perhaps he wants an epilepsy-inducing <blink> tag!
    – Eric
    May 27, 2010 at 11:33
  • yes man i want to toggling between show and hide i have done but it's not working at all
    – Piyush
    May 27, 2010 at 11:41

4 Answers 4

2
$(document).ready(function(){
    $('#hideButton').click(function(){
         $('#disclaimer,#clock').toggle();
    });
});
1
$(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/
    });
});
2
  • i have to check for that its working for me will get back to you if find solid reason for this May 27, 2010 at 12:26
  • hi! pranay, i had done some mistake in id. that's y it's not working. now it's working.
    – Piyush
    May 27, 2010 at 12:58
0

Use:

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

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

0

try

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.