I have the follow show/hide script that works correctly.
<html><head><title>my javascript show script</title><script type="text/javascript"> function showStuff(id) { if (document.getElementById(id).style.display == 'block') document.getElementById(id).style.display = 'none'; else document.getElementById(id).style.display = 'block' }</script></head><body><p><a href="#" onclick="showStuff('answer1'); return false;">What price are your apples?</a><br><span id="answer1" style="display: none;">Our apples are 30 pence each. If you buy 10 or more we can sell them at a discounted bulk rate of 25 pence each.</span></p></body></html>
Open in new window
I have removed the </p> after </span> and placed it before <span>..
The problem is </p> tag breaks and creates <p> for all lines within foreach statement which in turn moves the content outside span