How do i create a div with dojo create?

前端 未结 1 452
独厮守ぢ
独厮守ぢ 2021-01-26 03:59

i want to generate the divNodes0 div from this example via dojo create (including the h1 and ul):


    
相关标签:
1条回答
  • 2021-01-26 04:21

    If you want to look up nodes by Id, you generally want to use dojo.byId('someId')

    The third parameter to dojo.create can be either a domNode (like you are using) or an id of a dom node: dojo.create('h1',{},'divNodes0','first')

    Based on your usage of the dojoType attribute it seems like you want to use "widgets" rather than dom nodes. Widgets are generally a template of domnodes with built in styling and event handling that are easily reusable. Instantiating and placing widgets is simple:

    var heading = new dojox.mobile.Heading({
      id: "h1Nodes0",
      dojoType: "dojox.mobile.Heading",
      back: "zurŸck",
      moveTo: "divNodes0",
      fixed: "top",
      label: "Knotenübersicht"
    });
    heading.placeAt('divNodes0','first');
    
    0 讨论(0)
提交回复
热议问题