Here is a snippet of my HTML code:
<i id="bgcolor" style="background-color: rgb(255, 146, 180)"></i>
I am trying to retrieve the background-color value using jQuery's attr method. Here is what I have attempted so far:
$("#bgcolor").mouseleave(function(){
var bodyColor = $(this).attr("style");
$("body").css(bodyColor);
});
Unfortunately, this outputs:
background-color: rgb(255, 146, 180);
Adding this directly to my CSS does not work. How can I successfully achieve this task?