Problem executing code after slideToggle('slow')
Hello All,
I am working my way through the tutorial and found the following problem. If I use the following code, the if always returns true. However if I put in a alert() before the if it works correctly. What am I doing wrong?
$(document).ready(function(){
$('#celebs tbody tr:even').addClass('zebra');
$( '<input type="button" id="toggleButton" value="Hide" />' ).insertAfter( '#disclaimer' );
$( '#no-script' ).remove();
$( '#toggleButton' ).click(function() {
$( '#disclaimer' ).slideToggle('slow');
if ($('#disclaimer').is(':visible')) {
$(this).val('Hide');
} else {
$(this).val('Show');
}
});
})
Regards,
Arend