ainoy31 Posted September 25, 2009 Share Posted September 25, 2009 I have a checkbox that once clicked, it hides the current content data and displays the other content data. If I click on the checkbox, the current content data disappears but the content I want does not display. Also, if i click on the checkbox again, the checkbox itself disappears and the current content data re-appears. This is only happening in IE7. It works fine in FF and IE8. Hope this makes sense. PHP Code: <div id="nrai_check"><input type="checkbox" name="nrai" value="nrai_yes" onclick="showHideMe();"></div> <div style="font-size: 12px; font-weight: normal; line-height: 13px; color: #000000; font-family: Helvetica, Arial, Verdana, sans-serif; margin:3px 0 0 0;"> Message content goes here... ($120 for 1 year) </div> <div id="nrai" style="display:none; font-size: 12px; font-weight: bold; line-height: 13px; color: #000000; font-family: Helvetica, Arial, Verdana, sans-serif; margin:5px 0 0 22px;">Content Data.......</div> <div id="regAgentInfo" style="display:block;"> Agent content.... </div> javascript code: function showHideMe() { var nrai = document.getElementById('nrai'); var agent = document.getElementById('regAgentInfo'); var agent_same = document.getElementById('regagent_same'); if(nrai.style.display=='block') { nrai.style.display='none'; agent.style.display='block'; agent_same.disabled = false; } else { nrai.style.display='block'; agent.style.display='block'; agent_same.disabled = true; agent_same.checked = false; } } Please ignore the inline style. This is still in development stage. Much appreciation. AM Link to comment https://forums.phpfreaks.com/topic/175555-solved-issue-with-show-and-hide-divs-in-ie-7-with-checkbox/ Share on other sites More sharing options...
ainoy31 Posted September 25, 2009 Author Share Posted September 25, 2009 my checkbox name (name='nrai') was using the same name as mine hidden div id (div id="nrai"). I changed the checkbox name and it fixed my issue in IE7. Link to comment https://forums.phpfreaks.com/topic/175555-solved-issue-with-show-and-hide-divs-in-ie-7-with-checkbox/#findComment-925090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.