I have an image with white text "angel". I need it to be replaced with red one whenever I keep mouse over it.
<img src="img/angel_word.gif" class="word" id="angelWord">
<script>
$("#angelWord").hover(function(){
$("#angelWord").replaceWith('<img src="img/angel_word_red.gif" class="word" id="angelWord">');
},
function(){
$("#angelWord").replaceWith('<img src="img/angel_word.gif" class="word" id="angelWord">');
});
</script>`
I am not sure why but it doesnt work. The image becomes red, but when I get my mouse out of it, it stays red. I have also tried with mouseover, but it gives me no results as well:
$("#angelWord").mouseover(function(){
$("#angelWord").replaceWith('<img src="img/angel_word_red.gif" class="word" id="angelWord">');
});
$("#angelWord").mouseout(function(){
$("#angelWord").replaceWith('<img src="img/angel_word.gif" class="word" id="angelWord">');
});