show/hide div

Is there any built-in JS/AJAX function that will show/hide a div linked to a button?

jquery (show:hide)/toggle/(fadeIn/fadeOut) ?

Can you provide a full sample solution please?

http://docs.jquery.com/Effects

What I mean is can you provide a sample Yii code?

JS code (button has id "myButton", div has id "myDiv", "hidden" is a css class (display: none)):




$().ready(function(){

    $('#myButton').click(function(){

        $('#myDiv').toggleClass('hidden');

    });

});



Don’t forget to register a core script jQuery.

Cheers andy_s.

Do you know how that can be extended to enable the div to receive focus as soon as it is displayed?

EDIT: Ignore that - I got my answer :)

$().ready(function(){

    $('#myDiv').hide();


    $('#myDiv').show();

});