I am trying to check the image and replace the image for my expand and collapse <div> but i cant able to find the solution.
html code:
<h4 id="expanderHead">Virtual Room <span id="expanderSign">+</span></h4>
<div id="expanderContent" style="display:none">
content ... content...
</div>
jquery:
$(document).ready(function(){
$("#expanderHead").click(function(){
$("#expanderContent").slideToggle();
if ($("#expanderSign").text() == "+"){
$("#expanderSign").html("-")
}
else {
$("#expanderSign").text("+")
}
});
});
Here, instead of + and - i have to place <img src="" alt=""/> .
Thank you.
attr()andinnerHTMLbut its not working.