Prev Demo
jQuery
>
.Position() - Retrieve Position Of Element
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <style> h1{ color:blue; padding:10px; margin-top:10px; } </style> </head> <body> <h1>This is H1</h1> <h2>This is H2</h2> <H3>This is H3</h3> <script> var position = $("h1").position(); alert(position.left + " : " + position.top); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output