1

the div gets inserted to the right place but it also keeps the div in the old position, so then there is two elements not sure why it is being cloned. Im editing woocommerce theme.

$(document).ready(function(){

  $("#place_order").insertAfter("tbody");
});
Zygimantas
  • 553
  • 8
  • 22

2 Answers2

1

Use detach before insert after:

 $("#place_order").detach().insertAfter("tbody");

some more informations

Community
  • 1
  • 1
Luke
  • 362
  • 1
  • 4
  • 13
0

$(document).ready(function(){
  var createdDiv= document.createElement('div');
  createdDiv.id = 'place_order';
  $(createdDiv).insertAfter("tbody");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tbody><tr><td>list</td></tr></tbody>
</table>
sumit chauhan
  • 1,270
  • 1
  • 13
  • 18