title: How to attach an event listener to dynamically added widget content in Dojo toolkit
body: <p>I'm using laravel and dojo, so forms are generated by the server and are requested via ajax meaning there is no loading of the entire page, I want to assign an even listener on the submit button of the dynamically added content, with jquery I could simply do this on dom ready: </p>
  
  <pre><code>$('body').on('click','element',function(){//something});
  </code></pre>
  
  <p>But I have no clue how to do the same on Dojo, I can only assign event listeners to nodes that are already loaded on the page, and for widgets I use <code>registry.byId('element').on('click',function(){//something})</code></p>
  
  <p>And the documentation on dojo doesn't help at all</p>
  
  <p>The HTML is generated by laravel then sent back as an ajax response it looks like this:</p>
  
  <pre><code>`{{Form::open(array('class'=&gt;'rm-form','id'=&gt;'rm-form','files'=&gt;true))}}
  &lt;h3&gt;Capture Raw Material&lt;/h3&gt;
      &lt;div class="form-group"&gt;
      &lt;label for='mpo'&gt;Enter MPO:&lt;/label&gt;
          &lt;input data-dojo-type="dijit/form/TextBox" data-dojo-props='required:1' value='{{Input::old('mpo')}}' type="text" id='mpo' name='mpo' placeholder='Enter MPO Number' required /&gt;
              @if($errors-&gt;has("mpo"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('mpo')}}&lt;/span&gt;
              @endif
      &lt;/div&gt;
     &lt;div class="form-group"&gt;
      &lt;label for='rm-width'&gt;Enter Width:&lt;/label&gt;
          &lt;input id="rm-width" type="text" data-dojo-type="dijit/form/NumberTextBox" value='{{Input::old('rm-width')}}' name= "rm-width"  placeholder='Enter Width' constraints="{pattern: '0.######'}" required="true" /&gt;
          @if($errors-&gt;has("rm-width"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('rm-width')}}&lt;/span&gt;
              @endif
      &lt;/div&gt;
     &lt;div class="form-group"&gt;
      &lt;label for='rm-weight'&gt;Enter Weight:&lt;/label&gt;
          &lt;input id="rm-weight" type="text" data-dojo-type="dijit/form/NumberTextBox" name= "rm-weight" value='{{Input::old('rm-weight')}}' placeholder='Enter Width' constraints="{pattern: '0.######'}" required="true" /&gt;
          @if($errors-&gt;has("rm-weight"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('rm-weight')}}&lt;/span&gt;
              @endif
      &lt;/div&gt;
  
  
      &lt;div class="form-group"&gt;
      &lt;label for='blanks'&gt;Enter Estimated blanks:&lt;/label&gt;
          &lt;input id="estimated-blanks" type="text" data-dojo-type="dijit/form/NumberTextBox" name= "estimated-blanks" value='{{Input::old('estimated-blanks')}}' placeholder='Enter Enter Estimated Blank' }"
  required="true" /&gt;
              @if($errors-&gt;has("estimated-blanks"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('estimated-blanks')}}&lt;/span&gt;
              @endif
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
      &lt;label for='grade'&gt;Grades&lt;/label&gt;
          &lt;select name="grade" id='grade' data-dojo-type="dijit/form/Select"&gt;
              @foreach($grades as $grade)
              &lt;option value='{{$grade}}' {{$grade==Input::old('grade')?'checked':''}}&gt;{{$grade}}&lt;/option&gt;
              @endforeach
          &lt;/select&gt;
      &lt;/div&gt;
       &lt;div class="form-group"&gt;
      &lt;label for='grades'&gt;Date&lt;/label&gt;
          &lt;input type='date' name="text" id='date' data-dojo-type="dijit/form/DateTextBox" constraints="datePattern: 'dd-MM-yyyy'" value='{{Input::old('date')}}'  /&gt;
            @if($errors-&gt;has("date"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('date')}}&lt;/span&gt;
              @endif 
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label for='grades'&gt;Notes&lt;/label&gt;
              &lt;textarea name="notes" id='notes' data-dojo-type="dijit/form/Textarea"  &gt;
                  {{Input::old('notes')}}
              &lt;/textarea&gt;
             @if($errors-&gt;has("notes"))
                  &lt;span class="invalid"&gt;{{$errors-&gt;first('notes')}}&lt;/span&gt;
              @endif
      &lt;/div&gt;
          &lt;div class="form-group"&gt;
          &lt;div class="form-group"&gt;
          &lt;input type='file' id='file' name='file'/&gt;
          &lt;/div&gt;
          &lt;/div&gt;
      &lt;div class="form-group"&gt;
      &lt;button id="save-rm" type='button' data-dojo-type="dijit/form/Button" &gt;
          Create
      &lt;/button&gt;
      &lt;/div&gt;{{Form::close()}}`
  </code></pre>
  
  <p>And this is how I put it on DOM</p>
  
  <p><code>function rmrespnse(data)
  {
           require(['dijit/registry',"dijit/layout/ContentPane","dojo/domReady!"], function(registry,ContentPane){
          var cp = registry.byId('rm-body');
          cp.set('content',data);
  });}
  </code></p>