2

i want to create a div with the id divNodes1 as a child of a div with the id mobileView.

i tried this:

alert("before");
var divNodesName = dojo.domConstruct.create("div",{ id: "divNodes1" }, "mobileView");
alert("after");

it fires the "before" alert and not the "after". no console output.

EDIT:

now i tried to create a div with dojo.create witch should look like this:

<div dojoType="dojox.mobile.ScrollableView" id="divNodes1" scrollDir="v" style="background-color: #d0d0d0;">
<h1 dojoType="dojox.mobile.Heading" id="h1Nodes1" back="zurück" moveTo="divNodes0" fixed="top" label="overview"></h1>
<ul id="ulNodes1" dojoType="dojox.mobile.RoundRectList"></ul>
</div>

first of all i tried to construct the div as a child of the div "mobileView" with following command:

var mobileView = document.getElementById("mobileView");
var mainNodeDiv = dojo.create("div",{ id: "divNodes1" },mobileView,"first");

but when i am linking at diveNodes1 it doesnt find the div

EDIT2:

Now i tried this (without sucess):

var mobileView = document.getElementById("mobileView");
var mainNodeDiv = document.createElement("div");

mainNodeDiv.setAttribute("dojoType","dojox.mobile.ScrollableView");
mainNodeDiv.setAttribute("id","divNodes1");
//mainNodeDiv.setAttribute("scrollDir","v");
//mainNodeDiv.setAttribute("style","background-color: #d0d0d0");
//mobileView.appendChild(mainNodeDiv);
user2219190
  • 157
  • 2
  • 13
  • You need to be clearer about your problem. "linking at diveNodes1 it doesnt find the div" isn't clear at all. You mention trying to create a complex div with a h1 and ul inside it, but the code you show will only ever make a single (empty) div. "tried this (without success)" is even worse, what is success? what actually *did* happen? – Frances McMullin May 07 '13 at 10:24
  • i wrote a whole new code so i started a new question about this. Its already answered. Here a link to the other question (if interested) http://stackoverflow.com/questions/16398247/how-do-i-create-a-div-with-dojo-create/ – user2219190 May 07 '13 at 11:11

1 Answers1

1

dojo.domConstruct is not a thing that exists ever. To create an element in legacy mode Dojo, you need to use dojo.create.

C Snover
  • 17,908
  • 5
  • 29
  • 39