I figured out, I just changed the variable name, it now reads:
function show( i )
{
i.style.display = 'block';
}
But that doesn't seem to work either. . . No errors are returned, but the element's display isn't changed.
It returns this error: Error: missing formal parameter
Source Code: function show(this)
The function show() is this:
function show (this)
{
var list = document.this.style.display = 'block';
}
I'm thinking I just made another stupid mistake?
You are soo helpful!! :-D Thanks, mate!
Everything is working great. Except the show function needs to know what specific element was clicked, and then do something to only that element. How would I go about doing that?
Thanks again!
:-D Thank you! That worked perfectly! Now, what would be the simplest way to start a function every time one of the <li> tags is clicked.
var x = document.getElementById("options").getElementsByTagName('li');
for (var i=0;i<x.length;i++) x[i].onClick = show();
That automatically initiates...
I know how to toggle the display and everything, the only thing I can't grasp is the most simple way to hide the others when they aren't visible.
document.getElementsByTagName("li").display.style = "none";
Shouldn't it be something like that?
My html is like this
<ul id="menu1">
<li>
<span>Edit</span>
<div style="display: hidden;">
Edit the Info
</div>
</li>
<li>
<span>Delete</span>
<div style="display: hidden;">
Delete the Info
</div>
</li>
</ul>
Whenever someone...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.