EvanAbagail
02-10-2015, 07:47 PM
Hello.
I have a spoiler BBCode at the moment but it only shows and hides. Basically, I want it to when pressed show the content(like it does), but then change the button text to "Hide Spoiler" and when clicked when showing hide the content again. Thank you,
<div class="spoiler"><input type="button" class="button" onClick="this.nextSibling.nextSibling.style.display='block' ;this.parentNode.removeChild(this);" value="Show spoiler"> <span class="content" style="display:none">Bob is ugly.</span> </div>
Is my current code.
I have a spoiler BBCode at the moment but it only shows and hides. Basically, I want it to when pressed show the content(like it does), but then change the button text to "Hide Spoiler" and when clicked when showing hide the content again. Thank you,
<div class="spoiler"><input type="button" class="button" onClick="this.nextSibling.nextSibling.style.display='block' ;this.parentNode.removeChild(this);" value="Show spoiler"> <span class="content" style="display:none">Bob is ugly.</span> </div>
Is my current code.