Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hide/show tags in HTML

Featured Replies

I'm doing a website project on FrontPage 03, which has a jeopardy game in it. I need a way to put tags in that would hide the answer till someone clicked it. I did a bit of googling already, but couldn't find anything good.

 

I know you can do this with JavaScript, but I'd prefer to stay with just HTML.

 

EDIT - Apparently you can't do this with HTML, so does anyone know how to do it in javascript?

Ignore this. :D

That uses javascript :P

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

Javascript that modifies style properties works well

Novite_Mike.png

The corp beast, is, well, just a corp beast. He doesnt even have any friends.

[spoiler=Other Quotes]tbh idk why this makes me laugh so hard

All DFS threads turn into efficiency flame wars >.>

>OP asks "why use DFS?"

>everyone says "there is no reason"

>someone says "stop bashing people who use DFS, efficiency troll ass clown"

>thread is now a flame fest

 

I wouldn't use Frontpage if I were you, puts in a lot of junk. I prefer using Notepad++, or Aptana Studio (free) if you like the auto-suggest feature.

  • Author

I don't know HTML very well, so I'm using the split view so I can see the HTML build, but still see the final product and edit it like Word. I have no problem with using Javascript though, I just don't know how to implement it.

javascript.js

function toggleDisplayById(id)
{
var element = document.getElementById(id);
if(element.style.display == "none")
{
	element.style.display = "block";
}
else
{
	element.style.display = "none";
}
}

 

test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="javascript.js"></script>
</head>
<body>
<button type="button" onclick="toggleDisplayById('aaaaaa')">Click Me!</button>
<div id="aaaaaa">
	<p>text</p>
</div>
</body>
</html>

 

Notes:

#use css with style -

display:none;

for hiding on page load

 

Edit:

function modDisplayById(id, value)
{
var element = document.getElementById(id);
if(element)
{
	element.style.display = value;
}
}

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="javascript.js"></script>
</head>
<body>
<button type="button" onclick="modDisplayById('aaaaaa', 'block')">Show</button>
<button type="button" onclick="modDisplayById('aaaaaa', 'none')">Hide</button>
<div id="aaaaaa">
	<p>text</p>
</div>
</body>
</html>

Thanks Mark! No problemo Mark!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.