I have this bit of javascript which works great for more/less:
function show(area) {
var obj = document.getElementById(area)
obj.style.display = (obj.style.display == 'inline') ? 'none' : 'inline'
};
and my HTML looks like this:
<p>some text</p>
<A href="javascript:show('hiddentext#{loop.index}');">more...</A>
<p class="hidden" id="hiddentext#{loop.index}">more text</p>
The problem is, I need to be able to hide the link if there isn't any text to show. I'm using JSF and have multiple more/less links, but not all of them will have any more text to show.
I'm having an issue getting jQuery to work with my application (see here), so jQuery solutions won't work.