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'; } } Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.