Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to get the the (X,Y) positions of a HTML element?

Damian99Damian99 USAMember Posts: 116

Is there a way to retrieve the position (X,Y) of an HTML element?



  • DavidMDavidM USAMember Posts: 342
    edited February 2014

    You can use the .position() function of JQuery.

    From the official documentation,

      div {
        padding: 15px;
      p {
        margin-left: 10px;
      <script src="//"></script>
    var p = $( "p:first" );
    var position = p.position();
    $( "p:last" ).text( "left: " + position.left + ", top: " + );
Sign In or Register to comment.