显示鼠标选中文字
<!DOCTYPE html>
<html>
<head>
<meta charset=
"utf-8"
>
<meta name=
"viewport"
content=
"width=device-width"
>
<title>JS Bin</title>
</head>
<body>
<p>你好啊,那谁家的小谁。听说你在找一个人。我知道她在哪里。</p>
<script>
$(
'p'
).mouseup(
function
(){
var
txt = window.getSelection?window.getSelection():document.selection.createRange().text;
alert(txt) ;
})
</script>
</body>
</html>