How to insert an element between the two elements dynamically?

Posted by Harish on Stack Overflow See other posts from Stack Overflow or by Harish
Published on 2010-05-29T06:58:56Z Indexed on 2010/05/29 7:02 UTC
Read the original article Hit count: 270

Filed under:
|

I am using a table, in which there are buttons, on button click i want the new TR element to be inserted between the two TR or at the end of the TR... my code goes here

<table>
 <tbody>
   <tr>
     <td>
        <input type="submit" value="Add" onclick="addFunction()" />
     </td>
   </tr>
   <tr>
     <td>
        <input type="submit" value="Add" onclick="addFunction()" />
     </td>
   </tr>
   <tr>
     <td>
        <input type="submit" value="Add" onclick="addFunction()" />
     </td>
   </tr>
  </tbody>
 </table>

i want to insert new TR element next to the element which has triggered the event... NOTE: i am not using any javascript library, just plain javascript

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom