0

How can I filter my selector by what the user has selected???

I'm trying to find specific elements inside what the user has highlighted.

$('.item', document.selection) ?
$('.item', editor.getSelection().getRanges()[0]) ?
Teja Kantamneni
  • 16,851
  • 10
  • 54
  • 84
BadRaabutation
  • 103
  • 1
  • 3
  • 10

2 Answers2

0

Insert selected text on the page into textarea (jQuery)

This might help. Maybe push it into a hidden element and then have jQuery reference that

Community
  • 1
  • 1
Andrew Burgess
  • 5,270
  • 5
  • 28
  • 37
0

Check this out, it will give you the text a user has selected (highlighted) on a page. However, this will not get the DOM structure, but merely the text.

atp
  • 27,422
  • 41
  • 120
  • 179