I have this code :
function showContent() {
...
}
<div id="example">
content
<a href="#" onClick="showContent();return false">Link</a>
</div>
I’d like, when I click on the Link, show the content of the div, without using id or class as reference, but (maybe) the simple this.
How can I do it?
Well, there’s not a whole lot of context, but this is one way:
http://jsfiddle.net/LeVFb/
Or, if you wanted to show all within (and I don’t think the
:notreally matters* in this case):*In fact, I would go ahead and say leave it off unless you have a specific reason not to:
It would depend on the content you’re trying to display and whether any A tags are
display: hiddenand need to be shown.http://jsfiddle.net/LeVFb/2/
This could go a number of ways.