jquery - Double click word JavaScript window.getSelection in two INS tag -
my html is:
<p><ins data-id="1">111</ins><ins data-id="2">222</ins></p>
the output of code is:
if double click word, it's selecting complete word, this:
but want select letters based on ins tag data-id
ex:- if double click 111
want select 111
this:
how modify default double click selection javascript selection?
i tried following code:
var containerid = $(e.currenttarget); if (window.getselection) { var range = document.createrange(); range.selectnode(containerid); var sel = window.getselection() sel.removeallranges(); sel.addrange(range); }
but it's not working expected.
<p><ins data-id="1">111</ins>​<ins data-id="2">222</ins></p>
you put zero-width space between them: ​
Comments
Post a Comment