Based on this selectionStart/selectionEnd on input type="number" no longer allowed in Chrome and my own experiments, I understand that selectionStart
and selectionEnd
are null inside <input type="number">
elements. The question is, is there no way to get the caret position at all?
I tried using window.getSelection()
, as suggested here: https://medium.com/javascript-in-plain-english/how-to-find-the-caret-inside-a-contenteditable-element-955a5ad9bf81 but this also seems to return 0, and not the actual caret position.