jquery - Selecting "one" of many anchor tags from a paragraph on mouuseup? -


i in trouble code

$(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) }); 

how can select 1 anchor tag on mouseup selection based text below:

<div class="editor"> <p name="909037734">it long established fact reader distracted  readable content of page when looking @ layout. point of  using <a id="14998538924729" title="click follow link" class="pinklink" target="_blank" href="http://google.com">lorem ipsum</a> has more-or-less normal distribution of  letters, opposed using 'content here, content here', making  readable english. many desktop publishing <a id="93420055379223" title="click follow link" class="pinklink" target="_blank" href="http://facebook.com">packages</a> , web  page editors use lorem ipsum default model text, ,  search 'lorem ipsum' uncover many web sites still in  infancy. various versions have evolved on years,  accident, on purpose (injected <a id="52337704157880" title="click follow link" class="pinklink" target="_blank" href="http://yahoo.com">humour</a> , like).</p></div> 

please tell me this.

try :

$(document).on('mouseup','.editor p',function(e){     if(e.target.text!=undefined){         $("#"+e.target.id).before($("#"+e.target.id).html());         $("#"+e.target.id).remove();     } }); 

demo here

hope help


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -