I would like to point out that if you are really toggling <span> elements (you call your function togglespan
) then toggling between "none" and "block" may be the wrong thing, entirely.
<span>s are *inline* elements, meaning (for example) that you can do stuff like this:
This is an <span style="color: red;">example</span> of an inline element.
and it will appear in the browser all on the same line.
If you change span to display: block;
then that line would end up broken:
This is an
<span style="display: block; color: red;">example</span>
of an inline element.
That is, on multiple lines in the browser.
Normally, with <span>, you would want to toggle between "none" and "inline" (instead of "block").