Having Issue on Re-Ordering Contents in a Div Using jQuery

Having Issue on Re-Ordering Contents in a Div Using jQuery

Can you please take a look at This Demo and let me know why I am not able to reordering the buttons in .popover-content class. What I would like to do is different order of presenting the button on each click on #pop and as you can see I am using

$("#pop").on("click", function(){ $('.popover-content > button').each(function() { $(this).prependTo(this.parentNode); }); });

but it is not reordering the buttons!