use before() function in your code.
For example:
HTML:
<div id="showData">Out put will show before this element</div> <button type="button" id="myButton">Click here</button>
jQuery:
<script> $("body").on("click", "#myButton", function(e) { $('#showData').before('<div><p>Work Successful.</p></div>'); }) </script>
Question and answer is powered by AnsPress.io