title: Want to remove row onclick
body: <p>Hi I am new to Javascript (actually i work on php mysql).  I want to remove few dynamically generated rows . I want to pass element id to function and then remove from there. But id's are created dynamically.
  Below code has variable for number of rows to show, and a button in front of each row , onclick of button the two input elements in that row, should be removed.</p>
  
  <pre><code>    &lt;script&gt;
          function removeMore()
          {
              var elem = document.getElementById();
              elem.parentNode.removeChild(elem);
              return false;
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;?php
          $row=5;
          for($i=1; $i&lt; $row; $i++)
          {
              $img_id= "img_".$i;
              $cap_id= "cap_".$i;
              $row_id= $i*100;
              ?&gt;
                  &lt;table&gt;
                      &lt;tr id="&lt;?php echo $row_id;?&gt;"&gt;
                          &lt;td&gt;
                              &lt;input type="file" name="img[]" id="&lt;?php echo $img_id;?&gt;" /&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input type="text" name="cap[]" id="&lt;?php echo $cap_id;?&gt;" /&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input type="button" name="rem_but" id="&lt;?php echo $i; ?&gt;" value="&lt;?php echo $i; ?&gt;" onclick="removeMore(document.getElementsByName('rem_but')[0].value)" /&gt; 
                              &lt;!-- or may be something like this.value to get value of id. --&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;?php   
          }
      ?&gt;
  </code></pre>
  
  <p>I simply want to delete the row whose button is clicked</p>
  
  <p>HTML looks like this</p>
  
  <pre><code> &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
   &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script&gt;
  function removeMore(eid){
  document.write(eid);
  var xd= eid*100;
   var elem = document.getElementById(xd);
   elem.parentNode.removeChild(elem);
   return false;
   }
   &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;table&gt;
  &lt;tr id="100"&gt;&lt;td&gt;&lt;input type="file" name="img[]" id="img_1" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input  type="text" name="cap[]" id="cap_1" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="button" name="rem_but" id="1"  value="1" onclick="removeMore(document.getElementsById(this.value)" /&gt;
  &lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
   &lt;table&gt;
   &lt;tr id="200"&gt;&lt;td&gt;&lt;input type="file" name="img[]" id="img_2" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cap[]" id="cap_2" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="button" name="rem_but" id="2" value="2" onclick="removeMore(document.getElementsById(this.value)" /&gt;
   &lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
   &lt;table&gt;
   &lt;tr id="300"&gt;&lt;td&gt;&lt;input type="file" name="img[]" id="img_3" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cap[]" id="cap_3" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="button" name="rem_but" id="3" value="3" onclick="removeMore(document.getElementsById(this.value)" /&gt;
   &lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
   &lt;table&gt;
   &lt;tr id="400"&gt;&lt;td&gt;&lt;input type="file" name="img[]" id="img_4" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cap[]" id="cap_4" /&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="button" name="rem_but" id="4" value="4" onclick="removeMore(document.getElementsById(this.value)" /&gt;
   &lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>