remove dynamically generated table elements - Javascript DOM

Javascript examples for DOM:Element remove

Description

remove dynamically generated table elements

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <table id="test"> 
         <tbody>
            <tr> 
               <td>one</td>
               <td>two</td>
               <td id="test" onclick="removerow(this);">remove</td> 
            </tr> 
         </tbody>
      </table> 
      <script type="text/javascript">
function removerow(e) {//from  w  w w. j a  v a 2s  .c o  m
    e.parentNode.remove();
}

      </script>  
   </body>
</html>

Related Tutorials