Can we add/affect programmatically html elements with dojo toolkit?
i have a in开发者_如何学Cput 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?
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
精彩评论