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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -