How can I split the text in <p>Hello World!</p>
into Hello
and World
?
I tried:
document.querySelector('p').innerHTML.split(/&emsp/);
but it isn’t working
How can I split the text in <p>Hello World!</p>
into Hello
and World
?
I tried:
document.querySelector('p').innerHTML.split(/&emsp/);
but it isn’t working
2
Answers
You can spilit it by with withspace
s+
Use replace method:
And If you need the data in array