get the cursor position in the textarea or input elements