var rulearea = Ext.getCmp(文本域Id); var rulevalue = rulearea.getValue();// 获取文本textarea 里面的值 var start = rulearea.inputEl.dom.selectionStart; var end = rulearea.inputEl.dom.selectionEnd; var oriValue = rulearea.getValue().toString(); rulearea.setValue(oriValue.substring(0,start) + str + oriValue.substring(end));
在网上找了一下,解决了,谢谢原文作者提供!