How to split a string at the first `/` (slash) and surround part of it in a ``?

前端 未结 7 1698
独厮守ぢ
独厮守ぢ 2020-11-28 01:28

I want to format this date:

23/05/2013
.

First I want to split the string at the first / and have the res

相关标签:
7条回答
  • 2020-11-28 02:20

    try

    date.innerHTML= date.innerHTML.replace(/^(..)\//,'<span>$1</span></br>')
    <div id="date">23/05/2013</div>

    0 讨论(0)
提交回复
热议问题