jquery - How to get the style value using attr -
my html code here
<i id="bgcolor" style="background-color: rgb(255, 146, 180)"></i>
i want background-color value using jquery attr
what tried bellow
$("#bgcolor").mouseleave(function(){ var bodycolor = $(this).attr("style"); $("body").css(bodycolor); });
but output
background-color: rgb(255, 146, 180);
and add .css not work .how achieve task ?
check out documentation .css: http://api.jquery.com/css/
var bodycolor = $(this).css("backgroundcolor");
Comments
Post a Comment