javascript - Can I add a style tag to innerHTML? -


i'm trying post innerhtml table. font size in 1 cell bigger. possible include style tag so?

cell4.innerhtml = "<style: font-size:40px>" + "john doe" + "</style>" +  "</br>"; 

i tried following fiddle, isn't working. http://jsfiddle.net/s1dj3x8e/

the <style> tag meant container css code inside head, you're trying accomplish cannot done element in context.

try replacing following line:

cell4.innerhtml = "<style: font-size:40px>" + "john doe" + "</style>" +  "</br>"; 

with:

cell4.innerhtml = "<span style='font-size:40px'>john doe</span>"; 

updated fiddle (now span instead of div correctly pointed out zach below):

http://jsfiddle.net/jbhw1qf0/


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -