How to get the caret distance from the left inside an input field?

I want to know the caret distance from the left in side an input field. How can I achieve this ?

I know that inputEl.selectionStart will give me the position of the caret but how can I determine the distance from the left ?