I want to create something when clicking on the image inside the div
element. It should change it's color to blue, alongside changing the background color to blue. Is the code I am writing correct? Because it's not working properly. Also, is there a better way to apply CSS to elements?
var photo = $('#photo');
var html = $('html');
var bg = $('#bg');
$(photo).on('click', function(){
$(this).hide()
.delay(600)
.fadeIn(300);
$(html, bg).css({
background :'blue'
});
});
html
<div id='bg'>
<img id='photo' src="http://img.pixland.uz/u11878f337693s.jpg" alt="" />
</div>