Sindar
Sindar

Reputation: 10879

Retrieve the position of a clicked button?

Well, everything is on the question. I have a clickEvent on one of my button and i want to retrieve the position of this button when i click on it.

Actually i retrieve the position event.pageX but it's not really what i want...

<script type=text/javascript>
    $( "#dM1").click( function(event) {
        dropMenu('dropMenu1', event.pageX);
    });
</script>

Upvotes: 0

Views: 299

Answers (1)

lsuarez
lsuarez

Reputation: 4992

$(this).position() will have information regarding the object that was clicked within your event handler relative to the offset parent. $(this).offset() has positioning information relative to the document.

Upvotes: 2

Related Questions