【示例】
-
HTML
<!--省略-->
-
JS
$(document).ready(function(){ var clearSelection=function(){ if(document.selection&&document.selection.empty){ document.selection.empty(); }else if(window.getSelection){ var sel=window.getSelection(); sel.removeAllRanges(); } }; $(element).bind("dblclick",function(event){ clearSelection(); $("#div-log").html($("#div-log").html()+"<p>"+"鼠标双击事件,灰色区域内文本未被选中"+"</p>"); }); });