Hi, I have a read more script running on my CMS home page, works well, but I would like ot display an image rather than text
The code used is;
<script type="text/javascript">// <![CDATA[ function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "Read More"; } else { ele.style.display = "block"; text.innerHTML = "Hide"; } } // ]]></script>
<a id="displayText" href="javascript:toggle();"><img alt="Read More" src="/skin/frontend/rwd/default/images/Readmore_sml.png" /></a></p> <div id="toggleText" style="display: none;">
When I first load a page my image displays, but then when I click to 'read more' the image is replaced with text.
Thank you for you advice
Tony
Solved! Go to Solution.
Hi,
Just replace your line of code:
text.innerHTML = "Read More";
to
text.innerHTML = '<img alt="Read More" src="/skin/frontend/rwd/default/images/Readmore_sml.png" />';
I think it will work. If you still some issue please let me know.
Thanks,
Dibyajyoti