Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:06:23+00:00 2026-06-17T05:06:23+00:00

Hi I have a problem with dojo’s domConstruct.toDom and domConstruct.place. Which ever I use

  • 0

Hi I have a problem with dojo’s domConstruct.toDom and domConstruct.place.
Which ever I use both domConstruct functions or only domConstruct.place, I can’t seem to
place the long html list tags.
Please see my script below:

var row = domConstruct.toDom('<ul id="list">
<li class="odd">
    <div class="bold">
        <a class="odd">Odd</a>
    </div>
</li>
<li class="even">
    <div class="italic">
        <a class="even">Even</a>
    </div>
</li>
<li class="odd">
    <a class="odd">Odd</a>
</li>
<li class="even">
    <div class="bold">
        <a class="even">Even</a>
    </div>
</li>
<li class="odd">
    <div class="italic">
        <a class="odd">Odd</a>
    </div>
</li>
<li class="even">
    <a class="even">Even</a>
</li>

<ul id="list2">
<li class="odd">Odd</li></ul>');

domConstruct.place(row,"CPane_Chart");

Please advise, thanks in advance

Clement

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:06:25+00:00Added an answer on June 17, 2026 at 5:06 am

    The problem isn’t Dojo, it’s that you can’t have multi-line strings in JavaScript unless you escape the new line with a \ at the end. So you could do something like this:

    var row = domConstruct.toDom('<ul id="list"> \
    <li class="odd"> \
        <div class="bold"> \
            <a class="odd">Odd</a> \
    ....
    <li class="odd">Odd</li></ul>');
    

    Personally, though, I prefer putting HTML like this into an external HTML file and using dojo/text to load it:

    require(["dojo/text!myListHtml.html"], function(myListHtml){
         var row = domConstruct.toDom(myListHtml);
    });
    

    See http://dojotoolkit.org/reference-guide/1.8/dojo/text.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use dojo 1.8.2 and here is my problem (I have seen this and
in my Zend Framework App i wanna use Dojo Form. I have problem with
I have a problem with events on IE8 (dread!), using dojo toolkit 1.4.3 (can't
I think i have a basic problem in understanding the dojo toolkit. Well I
i have an custom widget in dojo. My Problem is to check some kind
I have a problem with a Struts2 + dojo web application that I've inherited.
I have this terrible problem with IE 7/8/9. I wrote an app using Dojo
I have seen this bug report for dojo which was fixed in 1.5.2, however
I have this problem I'm using DataGrid + dojo.store.JsonRest as store. I want to
I have a simple Dojo application, that does only one require call, loading all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.