我遇到了这个代码的麻烦
$(document).on('mouseup','.editor p',function(e){
var id = $(this).attr('name');
var $text = window.getSelection(this);
var al =$(this).find('a').length;
if($(this).text($text).w)
});
如何mouseup
根据以下文本选择一个锚标记:
<div class="editor">
<p name="909037734">It is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout. The point of
using <a id="14998538924729" title="Click to follow link" class="pinkLink" target="_blank" href="http://google.com">Lorem Ipsum</a> is that it has a more-or-less normal distribution of
letters, as opposed to using 'Content here, content here', making it
look like readable English. Many desktop publishing <a id="93420055379223" title="Click to follow link" class="pinkLink" target="_blank" href="http://facebook.com">packages</a> and web
page editors now use Lorem Ipsum as their default model text, and a
search for 'lorem ipsum' will uncover many web sites still in their
infancy. Various versions have evolved over the years, sometimes by
accident, sometimes on purpose (injected <a id="52337704157880" title="Click to follow link" class="pinkLink" target="_blank" href="http://yahoo.com">humour</a> and the like).</p></div>
请告诉我这件事。