P
P
partyzanx2018-02-26 10:02:28
JavaScript
partyzanx, 2018-02-26 10:02:28

How to replace space with br?

<span class="wfw">a little bit</span>
Link to the script
How to make it so that instead of a space it turns out<br/>

a
little
bit

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Spiridonov, 2018-02-26
@customtema

output = input.replace(' ','<br>'); // (remove spaces from < br >)

A
Anton fon Faust, 2018-02-26
@bubandos

We study this: https://learn.javascript.ru/document
then, using document.getElementsByClassName or document.querySelectorAll, we select the necessary elements, iterate over them and make a replacement using replace or split / join.
For $ 10 I will save you from having to read a multi-book caf)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question