Is there any way in JavaScript to determine the clicked position within the element or distance from left, right or center? I am not able to determine the position (left, center or right) of clicked area.
I have following table -
<tr id="ing-117">
<td style="width: 15%; vertical-align: middle; display: none;"><img src="arrow-left.png" class="arrow left hidden"></td>
<td style="width: 70%; text-align: left;" class="txt center lefted"><div class="in"></div>2 cups ice</td>
<td style="width: 15%; vertical-align: middle;"><img src="arrow-right.png" class="arrow right hidden"></td>
</tr>
and here is my js code -
$('.arrow').unbind('click')
.bind('click', function(event, is_triggered){
var th = $(this);
var x = event.clientX;
var y = event.clientY;
console.log(x , y);
but when I click on 2nd <td>
it prints undefined undefined
in console
Please help, Thanks.