I'm pretty new to JavaScript, so I hope you could help me.
I have a top navigation menu with text on image buttons. When the text is just one word everything is fine. When it consists of two words I want to cut the string on the space character and put the second word into the second line.
I know I can find the character with the indexof method. But how would I go from there?
Thanks
将' '
替换为'<br>'
。
s = s.replace(/ /g, '<br>')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.