storm_buster
storm_buster

Reputation: 7568

Can we add/affect programmatically html elements with dojo toolkit?

i have a input like this :

<input type="text" name="mailSubject"
         value="" />

i want it to be like this :

<input type="text" name="mailSubject"
        dojoType="dijit.form.ValidationTextBox"
        required="true"
        value="" />

but, i dont want to create a new input, juste to update the existing one adding the dojo stuff? is it possible?

Upvotes: 1

Views: 374

Answers (1)

DanMan
DanMan

Reputation: 11561

Sure:

var foo = new dijit.form.ValidationTextBox(/* Object? */ params, /* DomNode|String */ srcNodeRef);

As you can see, srcNodeRef can be either an element or an element's ID. So you could pass it your <input>'s ID and it should be replaced by dojo.

http://dojotoolkit.org/api/dijit/form/ValidationTextBox.html

Upvotes: 1

Related Questions