Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个表单,用户输入 01022013 格式和 onchange 它应该转换为日期格式。同样 onfocus 它应该是数字格式。请帮忙。
尝试这个:
'01022013'.replace(/(\d{2})(\d{2})(\d{4})/, '$1/$2/$3') // -> "01/02/2013"