> Can I make spoiler text in HTML?

Can I make spoiler text in HTML?

Posted at: 2014-12-18 
I tried the code you have listed and it didn't work as you hoped. But if I wrapped the spoiler text in a paragraph tag, it did work.



Name

Spoiler Content





I tried this using Safari 7.06. This is an HTML5 element that is not supported yet by all browsers.

If you're trying to make this work in other browsers, check out the CSS display property. You can set the display property of some text to be "none" and use JS to show or hide it.

There is probably a way to do it with JQuery.

http://www.w3schools.com/jquery/default....

If you display white text on a white background it will be invisible, but it will still take up space. You can use JQuery to change the color when you click on it.

Something like this:



But if you want the space to expand, I don't know how to do that (but I've seen it done).

I want to make a list of things that contain spoiler, and I want to make it so when you click on it the text will show. I have tried this;



Name
Spoiler Content



But this is really annoying and doesn't work as well as I thought it would. Any ideas?