Hi all, how to find the Input field Cursor current X position. can anyone please help me with this?

I need the scrolling Input field. I need the X position of the Cursor. Based on the Cursor X position I moved the previously entered text from left to right.

What are you using for input field?

Hi @chiefcll ,

Actually, I need an Input Field with scrolling (once the text length is exceeded from the width of the Input field. Text needs to scroll from right to left).


Previosly you suggest scrolling. But how to check the condition, like Text is cover the width or not.


I use cursorIndex method. Based on the cursorIndex value its not possible to achieve this. If I type 25characters the cursorIndex value will be 24. But the Inputfield has some width (ex: 500). If 25 characters will cover the width of the Inputfield because all the letters doesn’t have the same width size (Ex: l & L, LIGHTNING & lightning).

Per Sven in Slack:
If you want the index of the cursor you can use .cursorIndex : LightningJS.io - Documentation you want the actual X coordinate, you could do .tag('Cursor').x on the inputField.

Scrolling would require moving the input box. Might be easier to just make the input box longer and not deal with scrolling. :sweat_smile: