-1

I want to know how to get the html and text of spans that are selected. Example html:

<span>a</span>
<span>b</span>
<span>c</span>
<span>d</span>

so if I highlighted with my cursor (a-b)...I would get

var storedHtml =     `<span>a</span> <span>b</span>`
var text = "ab"

and the text would be stored in a hidden textarea

re1man
  • 2,337
  • 11
  • 38
  • 54

1 Answers1

1

There's a few articles on this already:

Community
  • 1
  • 1
Ryan Ternier
  • 8,714
  • 4
  • 46
  • 69