freelance84 Posted October 21, 2010 Share Posted October 21, 2010 Is this correct? I'm trying to write a simple function that will hide an id or show depending on its current status function hideShow(id) { document.getElementById(id) if (id == 'none') { document.id.style.display = 'inline'; } else { document.id.style.display = 'none'; } } Link to comment https://forums.phpfreaks.com/topic/216491-hideshow-and-id-with-one-button/ Share on other sites More sharing options...
freelance84 Posted October 21, 2010 Author Share Posted October 21, 2010 function hideShow(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'inline'; } else { document.getElementById(id).style.display = 'none'; } } Wierd isn't it, you can't do something for ages, post it on a forum and the pressure mounts to not look stupid so your mind sees the solution! Link to comment https://forums.phpfreaks.com/topic/216491-hideshow-and-id-with-one-button/#findComment-1124890 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.