Skip to content Skip to sidebar Skip to footer

In Extjs, How To Insert A Fixed String At Caret Position In A Textarea?

This question probably is asked in other framework, not sure if there is one on ExtJs, which I am new to. I wonder whether there is a simple example with a TextArea and a button. W

Solution 1:

You can actually do this straight from the DOM, using textareas selectionStart attribute to find the caret position.

So you could do something along the lines of

textArea.value = textArea.value.substring(0, selectionStart)+'???'+textArea.value.substring(selectionStart);

Here is a jsfiddle demonstrating this using a combination of Ext.get and Ext.getDom to select and modify the elements.

Post a Comment for "In Extjs, How To Insert A Fixed String At Caret Position In A Textarea?"