Possible Duplicate:
get jquery to return font-size in points
Using jQuery, I'm setting something to 16pt as that is what my previous versions of my web application did. The issue is that some point after I set my code as follows:
$(SELECTED).css("font-size","16pt");
I would need to fetch it. When I fetch it, it doesn't return 16pt, but instead 21px. Is there either a conversion ratio I can use, or a way to fetch 16pt?
var fetched_size = $(SELECTED).css("font-size");
As a follow up to this question, i had noticed that things are not looking they way they should on what i am building. The textbox holding my data seems to be holding certain information. Do you know why the following would not work?
var x = "32";
$("#fontsize").val(decodeURIComponent(x)); //this points to a input:text
//the above statement doesnt seem to override the current contents with the value of x.
I believe css
is for accessing the computed style. Just use the build-in style
property directly:
var fetched_size = $(SELECTED)[0].style.fontSize;