Show/hide element scripting problem
-
I have a list in the sidebar of my site that I want to start out collapsed, and give the user the ability to show it— pretty standard stuff.
Here is my script:
<script type="text/javascript" language="JavaScript"><!-- function ShowMemList() { document.getElementById('members-hidable').style.display = "block"; document.getElementById('members-off').style.display = "block"; document.getElementById('members-on').style.display = "none"; } function HideMemList() { document.getElementById('members-hidable').style.display = "none"; document.getElementById('members-off').style.display = "none"; document.getElementById('members-on').style.display = "block"; } //--></script>
Here is the html:
<div id='member-controls'> <a href='' id='members-on' onClick='ShowMemList()'>(Show members list)</a> <a href='' id='members-off' onClick='HideMemList()'>(Hide members list)</a> </div>"; <ul id='members-hidable'>
The “show” script works—except that immediately after, the page seems to reload and revert back to the original style attributes. I’ve never seen this happen when I have used this script on static pages. I this something WordPress is doing—and how do I make it stop?
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Show/hide element scripting problem’ is closed to new replies.