Hi all,
Im currently trying to learn JQuery and hope you can help explain my problem:
I have a paragraph that I have set to disappear on the click of the Hide button, I have also set the button to toggle between Hide and Show depending on whether or not the content is visible. My problem is, when I add ‘slow’ as the duration the button doesnt seem to toggle between hide and show?
<p id="disclaimer">
Disclaimer! This service is not intended for the those with criminal intent. Celebrities are kind of like people so their privacy should be respected.
</p>
$(document).ready(function() {
$('<input type="button" class="toggle" name="toggle" value="Hide" />').insertAfter('#disclaimer');
$('.toggle').click(function() {
$('#disclaimer').toggle('slow');
if($('#disclaimer').is(':visible')){
$(this).val('Hide');
}else{
$(this).val('Show');
}
});
$('<strong>START</strong>').prependTo('#disclaimer');
$('<strong>END</strong>').appendTo('#disclaimer');
});
It would be great if someone could explain where Im going wrong with this one, cheers!
Kyle