insert-text-at-cursor-in-a-content-editable-div
https://stackoverflow.com/questions/2920150/insert-text-at-cursor-in-a-content-editable-div
function insertTextAtCaret(text) {
var sel, range;
if (window.getSelection) {
sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0);
range.deleteContents();
range.insertNode( document.createTextNode(text) );
}
} else if (document.selection && document.selection.createRange) {
document.selection.createRange().text = text;
}
}
insert-text-at-cursor-in-a-content-editable-div的更多相关文章
- Jquery的text()和html()方法在li与div取值结果解析
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- HTML5 Content Editable实践
基于此开发文档:https://developer.mozilla.org/zh-CN/docs/Web/Guide/HTML/Content_Editable 问题:通过contenteditabl ...
- font 和 text ,cursor
font:14px/30px/"宋体"这种写法等于 font-size="14px" line-heigiht="30px" font-fa ...
- 指令-arContentedit-可编辑的高度自适应的div
<div ar-contentedit="true" contenteditable="true" contenteditable="pla ...
- [Linux-vi] The simple set of vi command
Source : https://www.cs.colostate.edu/helpdocs/vi.html What is vi? The default editor that comes wit ...
- AnjularJs的增删改查(单页网站)
2016.6.4 学习文献: 你的第一个AngularJS应用:https://segmentfault.com/a/1190000000347412 AngularJS 提交表单的方式:http:/ ...
- Python爬虫使用lxml模块爬取豆瓣读书排行榜并分析
上次使用了BeautifulSoup库爬取电影排行榜,爬取相对来说有点麻烦,爬取的速度也较慢.本次使用的lxml库,我个人是最喜欢的,爬取的语法很简单,爬取速度也快. 本次爬取的豆瓣书籍排行榜的首页地 ...
- Insert Plain Text and Images into RichTextBox at Runtime
Insert Plain Text and Images into RichTextBox at Runtime' https://www.codeproject.com/Articles/4544/ ...
- requests的content与text导致lxml的解析问题
title: requests的content与text导致lxml的解析问题 date: 2015-04-29 22:49:31 categories: 经验 tags: [Python,lxml, ...
- requests中text,content,json之间的区别
response.text : 返回一个字符串\n",content : 返回二进制\n",json() : 返回对象"
随机推荐
- WDA学习(23):UI Element:Radio Button Group & CheckBox Group使用
1.16 UI Element:Radio Button & CheckBox使用 本实例测试Radio Button Group,CheckBox Group等的使用. 注:Dropdown ...
- cadence报错because the library part is newer than the part in the design cache.Select the part in the cache and choose Design-Update Cache,and then place the part again.
cadence报错because the library part is newer than the part in the design cache.Select the part in the ...
- js正则 -180 到180 小数点后无限位、el-input
正则 -180 到180 小数点后无限位/^0$|^-?0\.\d*[1-9]$|^-?[1-9](\.\d*[1-9])?$|^-?[1-9]\d(\.\d*[1-9])?$|^-?1[0-7]\d ...
- 如何保证RabbitMQ的消息不会丢失?怎么保证RabbitMQ的可靠性?
生产者: 原因: 由于网络原因导致消息发送失败,消息队列没有接收到生产者发送的消息,但生产者认为消息发送成功. 解决办法: transaction模式:事务模式:开启事务,发送消息,成功提交事务,失败 ...
- Java基础|03.基础语法(2)
Java安全|03.Java基础语法(2) 00x1 单例模式 定义: 单例模式(Singleton Pattern)是 Java 中最简单的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一 ...
- 在开启hadoop时候报错:localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
此时 ssh localhost也会失败 原因是秘钥没有给自己, 运行ssh-copy-id -i ~/.ssh/id_rsa.pub root@localhost 即可解决.
- uart 理解
1: 串口字符串传输和单字节传输的差异体现在字节与字节间是或在停止位后有空闲位的插入(下图红箭头处,没有插入),即 uart_send("123") 和 uart_send('1 ...
- 如何卸载cdr x8?怎么把cdr x8彻底卸载删除干净重新安装的方法【转载】
标题:如何卸载cdr x8?怎么把cdr x8彻底卸载删除干净重新安装的方法.cdr x8显示已安装或者报错出现提示安装未完成某些产品无法安装的问题,怎么完全彻底删除清理干净cdr x8各种残留注册表 ...
- php【websocket】
在PHP中,开发者需要考虑的东西比较多,从socket的连接.建立.绑定.监听等都需要开发者自己去操作完成,对于初学者来说,难度方面也挺大的.下面就简单介绍一下,可供参考 一.socket协议的简介 ...
- scanf()函数的详解以及使用时需要注意的一些细节-C语言基础
这篇文章要探讨的是"scanf()函数的详解以及使用时需要注意的一些细节".涉及scanf()函数的应用和需要注意的问题.属于C语言基础篇(持续更新). scanf()(函数原型: ...