Show/hide content in multiple elements with jQuery

    [javascript]
    //Show and hide content by clicking a link; link has .toggle-link and any id, content has .toggle-object and #showme-"any id"
    $(‘.toggle-object’).hide();
    $(‘.toggle-object:first’).show(400);
    $(‘.toggle-link’).click(function() {
    var toggleid = $(this).attr(‘id’);
    //$(‘.toggle-object’).hide();
    $(‘#showme-‘+toggleid).slideToggle(400);
    });
    [/javascript]

    Leave a Reply