I wonder if anybody can explain why in the first created div the background color will not work and it does in the second example.
$("<div/>", {
width:300,
height:400,
backgroundColor:"#425412", //background-color does not work
text: "hello there"
}).appendTo("body");
Note: without the background-color property the div will be created.
// works as defined including background-color
$("<div style='width:300; height:400; background-color:#425412;'>hello there</div>").appendTo("body");
Does the first method have restrictions?
You need to make the
backgroundColorproperty a key of acssobject.jsFiddle.