Get coordinates of current div using javascript


<script type=”text/javascript”>
function onposition(event) {
pos_x = event.offsetX ? (event.offsetX) :event.pageX-me(‘#pointer_div’).val().offsetLeft
pos_y = event.offsetY ? (event.offsetY) :event.pageY-me(‘#pointer_div’).val().offsetTop;
}
//–>
</script>
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript”>
var me = jQuery || $.noConflict();
me(document).ready(function() {
me(‘#pointer_div’).on(‘click’, ”, function(e) {
onposition(e);
});
});

</script><div style=”width:250px;height:250px;background:green;” id=”pointer_div”></div>