双击firefox中可编辑的返回磨损选择对象内的锚标记

时间:2019-06-10 06:51:10

标签: javascript html firefox

双击contenteditable返回父元素内的锚标记作为Firefox中的选择对象。如何解决此问题,以便可以获取所选元素的对象。

$(".test").dblclick(function(){
  console.log(window.getSelection());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="test" contenteditable="true">
This is the link to 
<a href="google.com">google. You can click here.</a>
</div>

0 个答案:

没有答案