Get index JS cursor position in the input or texterea

<TextArea placeholder = " Please enter the expression " ID = " methodInput " > </ TextArea> 

acquires position: 
var TXT = document.getElementById ( " methodInput " )
     var cursurPosition = 0 ; 
    cursurPosition = txt.selectionStart; // get the cursor standard position

Guess you like

Origin www.cnblogs.com/xxflz/p/12054493.html