javascript - How to change an image which is inside a div when hover on the div -
i have image inside div block. when hover on div want div background color change , plus image inside div should changed. how can this?
you can use jquery:
assuming html this:
<div id='container'> <img src='1.jpg' /> </div>
add script:
$(function(){ $('#container').mouseover(function() { $(this).css('background', 'yellow'); $(this).find('img').attr('src', '2.jpg'); }) })
Comments
Post a Comment