如何在 HTML 中的输入字段中添加允许的符号?
How to add allowed symbols on input field in HTML?
我有自己创建的 input
标签,必须为 phone 号码字段:
<base-input
style="margin-bottom: 15px; width: 100%; max-width: 510px;"
v-model="phone"
type="tel"
placeholder="Mobile phone"
/>
如何只添加允许的符号(0-9 和 +)。我试图使用 pattern="[0-9]+"
,但它不起作用。另外,据我所知,它可以用正则表达式来完成,但我不知道如何在这里使用它
我有自己创建的 input
标签,必须为 phone 号码字段:
<base-input
style="margin-bottom: 15px; width: 100%; max-width: 510px;"
v-model="phone"
type="tel"
placeholder="Mobile phone"
/>
如何只添加允许的符号(0-9 和 +)。我试图使用 pattern="[0-9]+"
,但它不起作用。另外,据我所知,它可以用正则表达式来完成,但我不知道如何在这里使用它