I'm using dojo 1.8 and I'm trying to set a Margin left to a div node but it's not rendering it in IE8.
Here's what I have:
dojo.create("div", {"class": "something", style: "margin-left:100px;"}, this.something);
Can someone help me out please?
dojo.create()
is deprecated in Dojo 1.8 . You should use dojo/dom-construct::create() instead.
You also need to make your style
attribute an object:
domConstruct.create("div", { style: { "margin-left": "100px" }, "class": "something" }, this.something);
Another approach would be to delegate applying your styles and class(es) to dom-style
and dom-class
, respectively:
var myNode = domConstruct.create("div", null, this.something);
domStyle.set(myNode, "margin-left", "100px");
domClass.add(myNode, "something");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.