开发者

Quick question to string handling

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


Replace ' ' with '<br>'.

s = s.replace(/ /g, '<br>')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜