Set offset coordinates of the p element
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/*from w w w . j a v a 2s . c om*/ <script> $(document).ready(function(){ $("button").click(function(){ $("p").offset(function(n, c){ newPos = new Object(); newPos.left = c.left + 100; newPos.top = c.top + 100; return newPos; }); }); }); </script> </head> <body> <p>This is a paragraph.</p> <button>Set</button> </body> </html>