0 Adding Spoiler Button in Post on Blogger

Spoiler Button is used if you want to give the user a choice to show or hide an item, can be images, text, etc.

The code:

<div style="margin-bottom: 2px;">
<div class="smallfont" style="margin-bottom: 2px;">
<input onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';  this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" style="font-size: 10px; margin: 0px; padding: 0px; width: 65px;" type="button" value="Show" /></div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px;">
<div style="display: none;">
Enter content you want to hide </div>
</div>
</div>
That's it!!! Let's try it below:

Enter Your Spoiler Message

No comments:

Post a Comment