SO - 18225499
by Arun P Johny
HTML
<table>
<tr>
<td id="example">
Something is inside here.
<button id="paymentBtn">pay</button>
</td>
</tr>
</table>
<button id="add">Add</button>
<button id="remove">Remove</button>
JavaScript
$('#add').click(function(){
$("#paymentBtn").before("<span>inserted new one</span>");
})
$('#remove').click(function(){
$("#paymentBtn").prev('span').remove();
})