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 8663035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:52:58+00:00 2026-06-12T16:52:58+00:00

I am new to Dojo and cannot seem to find the appropriate documentation or

  • 0

I am new to Dojo and cannot seem to find the appropriate documentation or examples on how to do what I am trying to accomplish. I am working on creating a decision tree style document that dynamically adds new options to an existing element. The code should add a new node to the end of a specific DIV. To do this, it must find the value attribute of an element called branchID. It then increments the value by one and adds new HTML to the page. In jQuery, I would use this

$('#btnAddFork').click( function(){
    var branchID = $('#branchID').attr( 'value' );
    var newNodeHTML = "<div class='node'>new node #" + (++n) + "</div>';
    $('div#NodeDIV').append( newForkHTML );
});

This code works in the proof of concept I created before requirements changes forced me to use a different framework. I am trying the following in Dojo

require(["dojo/dom-construct", "dojo/dom", "dojo/dom-attr", "dojo/on", "dojo/domReady!"],
function(domConstruct, dom, on){
  on(dom.byId("btnAddFork"), "click", function(){
    var n = domAttr.get("branchID", "value");
    domConstruct.place("<div class='node'>new node #" + (++n) + "</div>", "NodeDIV");
  });
}); 

The Dojo code is dying on the line where I attempt to assign a value to n. The error message is “TypeError: object is not a function”. The error message hasn’t pointed me in the right direction toward finding the solution. I am sure that it is the way I’m tring to use the domAttr.get function to get a value but I cannot seem to find the way to make this work the way that I would expect it to. How does Dojo handle things like this? It would be very helpful if someone could point to the documentation on how/why the solution needs to be written the way it does.

  • 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-12T16:53:00+00:00Added an answer on June 12, 2026 at 4:53 pm

    I was able to find the solution for this question but instead of removing the question, I will provide the details about what I found so that others may not make what is really a beginner level error. The problem was the way that I was writing the function definition after the require statement. The function definition requires each item from require to be specified (other than domReady! since it is a helper function for the loader). I missed this small detail when I was reading through the documentation. The following code works exactly as expected.

    require(["dojo/dom-construct", "dojo/dom", "dojo/on", "dojo/dom-attr", "dojo/domReady!"],
    function(domConstruct, dom, on, domAttr){
      on(dom.byId("btnAddFork"), "click", function(){
        var n = domAttr.get("branchID", "value");
        domConstruct.place("<div class='node'>new node #" + (++n) + "</div>", "NodeDIV"); 
        domAttr.set("branchID", "value", n);
      });
    });
    

    Notice that in the working code, I added domAttr to the function definition. Once I had read through all of the documentation for domAttr for probably the fourth or fifth time, I realized that I was not adding it to the function definition. The Dojo documentation that I have read isn’t completely clear about building the require statement and how to use it so I missed this the first few times around.

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

Sidebar

Related Questions

I am new to DOJO 1.6 I trying to display tree with sub folders.
I'm new to Dojo, and I'm trying to get my head wrapped around some
I am new to Dojo and trying to understand how to handle events. There
i'm quite new to Dojo, but i am trying to convert an existing javascript
Examples found in the dojo documentation won't load in IE. Such as: http://docs.dojocampus.org/dijit/Calendar I've
I'm new on Dojo, and I'm trying to validate a form (like the last
I wrote the following code to create a dojo tree. store = new dojo.data.ItemFileWriteStore({url:
I am new to Dojo programming and trying to create a ValidationTextBox for username
Hi I'm new to javascript and dojo. I'm trying to use two dijit DateTextBoxes
I'm very new to dojo, so please bear with me. I'm currently working on

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.