title: javascript removechild and remove not working
body: <p>I'm trying to generate a row dynamically. It's generating but, I'm not able to remove the row....</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    &lt;script type="text/javascript"&gt;
      
              function Clonediv(divid) {
                  var application_id = $('#app_id').val();
                  //var rn = $('#rownum').val;
  // var i = 0;
                  //alert(rn);
                  var rownum;
                  if (application_id != "") {
                      var cloned = $('#hdnClonedrows').val();
                      var num = parseInt(cloned);
                      num = num + 1;
                      i = i + 1;
                      $('#hdnClonedrows').val(num);
                      clonedelement = num;
                      rownum = "Requirement" + i;
                      // alert(rownum);
                      var newtr = document.createElement('tbody');
                      newtr.id = "Clonedrow_" + clonedelement;
                      $('#tableroles1').append(newtr);
                      $('#rowtoclone').css("display", "block");
                      var abc = $('#rowtoclone').clone();
                      $('#rowtoclone').css("display", "none");
                      abc.appendTo(newtr);
                  }
                  else {
                      alert("Please select an application to add a Requirement");
                      //$('#errordiv').html('Please select an application to add a Requirement&lt;br/&gt;&lt;br/&gt;');
                  }
              }
              $("#remove").on("click", ".removebutton", function (e) {
                  //e.preventDefault();
                  //e.stopImmediatePropagation();
                  e.removeChild(tableroles1);
                  $(this).parents("newtr").remove();
              });
                  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
      
      &lt;a id="Adddiv" class="clAddNewLeft" href="javascript:Clonediv();"&gt;Add Requirements&lt;/a&gt;&lt;br /&gt;
                  @{
                      string rowid = "Clonedrow_" + @clonedelement;
                      int rownum = 1;
                          //rownum = rownum + 1;
            
                      &lt;div id = '@rowid'&gt;
      
                          &lt;table id="tableroles1"&gt;
      
                              &lt;tr id="rowtoclone" style="display: none"&gt;
      
                                  &lt;td&gt;
                                      &lt;label id="rownum"&gt;Requirement @rownum  &lt;/label&gt;
      
                                  &lt;/td&gt;
      
                                  &lt;td class="editValue"&gt;
                                      @Html.TextAreaFor(m =&gt; m.requirements, new { @class = "updatable", @style = "height : 150px; width : 653px" })
      
                                  &lt;/td&gt;
                                  &lt;td class="editValue"&gt;
                                      @using (Html.BeginForm("FileUpload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
                                      {
                                          &lt;input type="file" name="file" id="fileToUpload" /&gt;
                                          &lt;input type="submit" id="btnSubmit" value="upload" /&gt;
                                      }
      
                                  &lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;img alt="delete" src="../../Images/deleteIcon4.gif" id="remove" style="cursor: pointer;" /&gt;
                                  &lt;/td&gt;
      
                              &lt;/tr&gt;
                          &lt;/table&gt;
                      &lt;/div&gt;
                  }
      
  
      
      
      
      
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>