<script type="text/javascript"> // zwijanie subforow $(document).ready( function () { $('.forum').each( function () { $(this).children('.schowaj_subfora').click(function () { $(this).parent().children('#subfora').slideToggle('slow'); $(this).parent().children('.schowaj_subfora').css('display', 'none'); $(this).parent().children('.pokaz_subfora').css('display', 'inline-block'); }); $(this).children('.pokaz_subfora').click(function () { $(this).parent().children('#subfora').slideToggle('slow'); $(this).parent().children('.pokaz_subfora').css('display', 'none'); $(this).parent().children('.schowaj_subfora').css('display', 'block'); }); }); }); </script> <style> .pokaz_subfora { display:none; } .schowaj_subfora { display:block; } </style> <div class="forum"> <div id="subfora"> test </div> </div>
Pokazuje on i chowa tekst 'test'
Chciałbym ten kod tak przerobić że jak klikam ukryj subfora to chowa się ten tekst 'test' i odkrywa się tekst 'test2' i później jak kliknę na pokaż subfora to żeby ukrywał się tekst 'test2' i pokazywał tekst 'test'.
Próbowałem to przerobić, lecz jQuery to moja słaba strona.
Proszę o pomoc