Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript remove clicked table row from table

<script>
    function RemoveRow(o) {
     //no clue what to put here?
     var p=o.parentNode.parentNode;
         p.parentNode.removeChild(p);
    }
</script>

<table>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow(this)"></td>
   </tr>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow(this)"></td>
   </tr>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow(this)"></td>
   </tr>
</table>
Comment

javascript remove clicked table row from table

<script>
  function RemoveRow() {
      // event.target will be the input element.
      var td = event.target.parentNode; 
      var tr = td.parentNode; // the row to be removed
      tr.parentNode.removeChild(tr);
</script>

<table>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow()"></td>
   </tr>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow()"></td>
   </tr>
   <tr>
       <td><input type="button" value="Delete Row" onclick="RemoveRow()"></td>
   </tr>
</table>
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to take a input video 
Javascript :: javascript object first key 
Javascript :: javascript not empty array not string 
Javascript :: how to change active tab jquery 
Javascript :: jquery ajax while loading 
Javascript :: javascript load multiple images 
Javascript :: polyfill for apply 
Javascript :: how to get last element of array 
Javascript :: noise margin in digital electronics 
Javascript :: jquery change picture onclick 
Javascript :: js indexof nested array 
Javascript :: check fro text input jquery 
Javascript :: js first letter capital 
Javascript :: check if over 18 javascript 
Javascript :: jquery remove keypress event 
Javascript :: port 3000 is already in use nodemon app crashed 
Javascript :: sum of number using reduce 
Javascript :: browser javascript update url without changing history 
Javascript :: how to pass props in react test cases 
Javascript :: simulate click jest 
Javascript :: how to cheack if a number is an integer or float in javascript 
Javascript :: .env not working on react 
Javascript :: how to map through array of iterators 
Javascript :: js change button text 
Javascript :: javascript object entries 
Javascript :: generate random string javascript 
Javascript :: converting json to javascript object 
Javascript :: eof while parsing 
Javascript :: js check if radio button is checked 
Javascript :: js import jquery 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =