My HTML CODE HERE:
<i id="bgcolor" style="background-color: rgb(255, 146, 180)"></i>
I want to get the background-color value using jquery attr. What i tried is below:
$("#bgcolor").mouseleave(function(){
var bodyColor = $(this).attr("style");
$("body").css(bodyColor);
});
But this output is:
background-color: rgb(255, 146, 180);
And now that I've added it to my css it will not work. How can I achieve this task?
Check out the documentation for .css: http://api.jquery.com/css/
var bodyColor = $(this).css("backgroundColor");