javascript - How to add a new Dijit widget to a page? -


i have form variable number of inputs. behavior looking have link in user can click on , add new input form can filled. this

html:

<form id="myform">     <input data-dojo-type="dijit.form.textarea"/>     <a href="#" onclick="add_new_input()"> add new input</a>   </form>  

javascript:

<script>     function add_new_input(){       var newinput = $("<input data-dojo-type='dijit.form.textarea'/> ");       $('#myform').append(newinput);     }   </script>  

this add regular text input html , not dijit widget! have suggestions?

i defining class input file , bind input type on ($document).ready() did not work either! :(

it pretty simple problem solve creating textarea widget programmatically (as mentioned @paul grime). can see example here textareas created link dijit widgets. did not use jquery in fiddle, need change add_new_input function to

function add_new_input (){   var newinput = new textarea({      // custom properties here.    });   domconstruct.place(newinput.domnode, "myform");    // can alternatively place if don't want use   // dojo/dom-construct module...   // dojo.byid('myform').appendchild(newinput.domnode);       // or jquery...   // $("myform").append(newinput.domnode); }    

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -