Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/446.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何捕获文本选择上的事件_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如何捕获文本选择上的事件

Javascript 如何捕获文本选择上的事件,javascript,jquery,html,Javascript,Jquery,Html,我正在编写一个JavaScript脚本,用于对文本选择执行任何操作: HTML <div class="text"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a

我正在编写一个JavaScript脚本,用于对文本选择执行任何操作:

HTML

<div class="text">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem 
Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of
type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release 
of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
PageMaker including versions of Lorem Ipsum.
</div>
你有打字错误

$(this).one("mouseup", function () {
这应该是

$(this).on("mouseup", function () { 

现在可以用了吗?

可以用了,有什么问题吗?顺便问一下,问题是什么?看:可能你忘了把你的代码放在文档里。readyduplicate看起来不错,没什么问题。伙计们,我没有遗漏任何东西。我用了一个来代替on。jQuery1.7中引入的一个,与.on()相同。如果我错了,请纠正我
$(this).on("mouseup", function () {