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 ?

enter image description here

check out documentation .css: http://api.jquery.com/css/

var bodycolor = $(this).css("backgroundcolor"); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -