I'm creating a text editor and making use of the contentEditable property on a <div>. My function to specify the font currently using:
Size', false, fSize)
where fSize is a number from 1 to 7, corresponding to the allowable values for <font size="XXX">.
However, this does not support specifying the font size in pixels. Have seen various posts about this on the internet, but no solution has been posted, just one saying that it must be implemented using DOM+ functions.
I came up with the attached code, which works if a user has selected some text, but this depends on some text being selected.
selection.pasteHTML("<span style='font-size: 24px;'>" + selection.htmlText + "</span>");