I’m not able to change font size using Jquery. I want to change font size of a div. I have defined default font size for body as 12. I tried to change it as follows, but it didn’t work 🙁
$("#SelFontSize").change(function(){
$("#"+styleTarget).css({'font-size':'"+$(this).val()+"px'});
});
Try:
By putting the value in quotes, it becomes a string, and
"+$(this).val()+"pxis definitely not close to a font value. There are a couple of ways of setting the style properties of an element:Using a map:
Using key and value parameters:
All of these are valid.
You can replace
"fontSize"with"font-size"but it will have to be quoted then.