I have this jQuery call for a dropdown. On click, the background image of an inner container changes its background image. How do I change the background image for the inner container back?
$(document).ready(function () {
$('#listH1').click(function () {
$('#content1').slideToggle('medium');
$(".span").css("background-image","url(carrow.png)");
});
});
I suggest using
toggleClass():CSS
JavaScript
EDIT
Here’s a working fiddle. A couple things to note:
toggleClass()wasn’t working because of thespanclass. Adding!importantto thetoggleDownclass was all that was needed.