jquery - Find font-family of the html element on which mouse is currently pointing? -


i want find out font family of html element on mouse hovering. please not suggest chrome/ff plugin this, want create 1 myself :p

here have been trying: http://jsfiddle.net/c2duz/

html :

<div id="a">hasdashd kjsa sdkjsahd kjahdkjsahd kjahdkjahd kja hdkja hdkjahdskjahdkja</div> <div id="b">hasdashd kjsa sdkjsahd kjahdkjsahd kjahdkjahd kja hdkja hdkjahdskjahdkja</div> <div id="c">hasdashd kjsa sdkjsahd kjahdkjsahd kjahdkjahd kja hdkja hdkjahdskjahdkja</div> <div id="message"></div> 

css:

#a {font-family: arial;} #b {font-family: tahoma;} #c {font-family: georgia;} 

jquery

$('*').hover(function() {     hoverelem =     var font = hoverelem.css("font-family");     $("#message").append(font); }); 

please advice.

change js thus:

hoverelem = $(this);

in order ensure referencing jquery object , have access css method


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -