摘要:
最近工作需要写了一个工具方法用来在textarea里面插入文本,代码如下: ctx.insertText = function (el, txt) { var dom = el.get(0); if (window.getSelection) { var start = dom.selectionStart, end = dom.selectionEnd, temp = dom.value; dom.value = temp.substring(0, start) + txt + temp.substring(end... 阅读全文