Javascript Selectionstart & Selectionend
I'm having some difficulties getting the script below to work with my text editor. I'm not sure what is wrong but selectionStart and selectionEnd are returning as undefined. Its su
Solution 1:
The reason selectionStart
and selectionEnd
are undefined is that your textarea
variable contains a string, not a reference to a <textarea>
element. You seem to be aware of this since elsewhere you're calling string methods such as substring
. Just to be clear, strings have no selectionStart
and selectionEnd
properties; the objects that do are textareas and text inputs.
Post a Comment for "Javascript Selectionstart & Selectionend"