I have a string:
"some text 0 <span>span 0 </span>some text 1<span>span 1</span>"
I would like to transform it into some kind of structure like:
[
{ text: 'some text 0' },
{ span: 'span 0' },
{ text: 'some text 1' },
{ span: 'span 1' }
]
I know I can cast it to jquery and use find to get an array of spans, but is there a way to get an array as above?
Thanks!
<span>s?