Reputation: 6712
Currently I have set up a button to Show Disqus Comments
I would also like to have a button to Hide the Disqus Comments after they have been loaded
My current code for the show button is:
<div id="disqus_thread"></div>
<div id="disqus_loader" class="button" style="text-align: center">
<button onclick='$.ajaxSetup({cache:true});$.getScript("http://westonganger.disqus.com/embed.js");$.ajaxSetup({cache:false});
$("#disqus_loader").remove();'>Show Comments</button>
</div>
I am just delving into javascript and jquery, so if someone could help me that would be great
Upvotes: 0
Views: 1251
Reputation: 128791
Change:
$("#disqus_loader").remove();
To:
$("#disqus_loader").toggle();
This will switch between display: none
and display: block
.
Calling remove()
removes the content from the DOM completely.
Upvotes: 1