user2965439
user2965439

Reputation: 9

Jquery onmouseover change image

It´s possible do this , i want change image onmouseover :

<img src="icon_rss.png" border="0" alt="" onmouseover="jQuery(this).css('background-image':'url(icon_rss_over.png)');" />

I try change image onmouseover with jquery or i do something bad , i think i do all ok but no get results ok for change the image when go to the cursor over


At the moment i can´t do works fine , thank´s for the help

The best regards !!!

Upvotes: 0

Views: 707

Answers (2)

You have Typo

onmouseover="jQuery(this).css('background-image','url(icon_rss_over.png)');"
                                                ^ //you need , not :


or you can do it also with : we use .css({}) to assign multiple properties.one or more than one.

onmouseover="jQuery(this).css({'background-image':'url(icon_rss_over.png)'});"
                              ^                  ^                        ^

Reference

.css()

Upvotes: 1

Hozikimaru
Hozikimaru

Reputation: 1156

You should check for duplicate threads before you post the same question. I believe this is a good enough explanation how to accomplish what you are asking for;

Change the image source on rollover using jQuery

Upvotes: 0

Related Questions