Get cursor position (in characters) within a text Input field

后端 未结 9 1256
孤城傲影
孤城傲影 2020-11-22 01:22

How can I get the caret position from within an input field?

I have found a few bits and pieces via Google, but nothing bullet proof.

Basically something lik

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 01:38

    Got a very simple solution. Try the following code with verified result-

    
    
    
    
    
    
        
    
    
    

    I'm giving you the fiddle_demo

提交回复
热议问题