title: Delete table row using parent.removeChild(child)
body: <p>I have a table which starts off blank when a user opens the page and has rows added to it by the user. The user searches a DB and the results are echoed to a "Search results" table with the code below.</p>
  
  <pre><code>while ($dbsearch = mysqli_fetch_assoc($run_query))
           {
              $dbu = $dbsearch['Username'];
              $id = $dbsearch['PlayerID'];
              $func = "add(" . $id . ", Brad Henry )";
           array_push ($_SESSION['players'],$dbsearch['PlayerID']);
           echo "&lt;tr&gt;&lt;td&gt;".$id ."&lt;/td&gt;&lt;td&gt;".$dbu."&lt;/td&gt;&lt;td&gt;&lt;input type=\"submit\" id=\"PlayerAdded".$id."\" value=\"Add\" onclick=\"add('".$id."','".$dbu."');\"&gt;&lt;/input&gt;&lt;/td&gt;&lt;/tr&gt;";
           }
  </code></pre>
  
  <p>This is working very well. When the user clicks add, the following function adds the search result to the "Todays event" table:</p>
  
  <pre><code>function add(id,name){
      var t = ("&lt;/td&gt;&lt;td&gt;");
      var str = ("&lt;tr id='Players" + id + "'&gt;&lt;td&gt;")
      var ctr = ("&lt;/td&gt;&lt;/tr&gt;")
      var place = ("&lt;select name='place'&gt;&lt;option value='17'&gt;17th&lt;/option&gt;&lt;option value='16'&gt;16th&lt;/option&gt;&lt;option value='15'&gt;15th&lt;/option&gt;&lt;option value='14'&gt;14th&lt;/option&gt;&lt;option value='13'&gt;13th&lt;/option&gt;&lt;option value='12'&gt;12th&lt;/option&gt;&lt;option value='11'&gt;11th&lt;/option&gt;&lt;option value='10'&gt;10th&lt;/option&gt;&lt;option value='9'&gt;9th&lt;/option&gt;&lt;option value='8'&gt;8th&lt;/option&gt;&lt;option value='7'&gt;7th&lt;/option&gt;&lt;option value='6'&gt;6th&lt;/option&gt;&lt;option value='5'&gt;5th&lt;/option&gt;&lt;option value='4'&gt;4th&lt;/option&gt;&lt;option value='3'&gt;3rd&lt;/option&gt;&lt;option value='2'&gt;2nd&lt;/option&gt;&lt;option value='1'&gt;1st&lt;/option&gt;&lt;/select&gt;")
      var points = ("&lt;input name='points' placeholder='50'&gt;&lt;/input&gt;");
      var cash = ("$&lt;input name='cash' placeholder='0'&gt;&lt;/input&gt;");
      var ticket = ("&lt;select name='ticket'&gt;&lt;option value='No'&gt;No&lt;/option&gt;&lt;option value='Yes'&gt;Yes&lt;/option&gt;");
      var del = ("&lt;input type='submit' value='Delete' onclick='remove(" + id + ")'&gt; &lt;/input&gt;")
  
     $('#PlayerAdded').before(str+ id + t + name + t + place + t + points + t + cash + t + ticket + t + del + ctr);
  }
  </code></pre>
  
  <p>My issue is that nothing happens when the Delete button (see var del) is clicked. <code>var del</code> calls the "Remove" function which is pasted below. I'm not sure where the error is and I have been searching online for an answer, but to no avail. I wonder if I am declaring <code>var child</code> incorrectly as it looks for an elementID with both a string and int...</p>
  
  <pre><code>function remove(RowID) {
      var parent = document.getElementById("resultTable");
      var child = document.getElementById("Players" + RowID);
      parent.removeChild(child);
  }
  </code></pre>