Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
How to add allowed symbols on input field in HTML?

I have my own create input tag which has to field for phone number:

    <base-input
        style="margin-bottom: 15px; width: 100%; max-width: 510px;"
        v-model="phone"
        type="tel"
        placeholder="Mobile phone"
    />

How can I add only allowed symbols (0-9 and +). I was trying to use pattern="[0-9]+", but it doesn't work. Also, as I know, it can be done with regular expressions, but I don't know how to use it here

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Use the regex ^[0-9+]+$. It allows numbers and +

Example here

about 4 years ago · Juan Pablo Isaza Relatório

0

The HTML input tag has a pattern attribute that receives a RegEx.

for your case:

<input
style="margin-bottom: 15px; width: 100%; max-width: 510px;"
v-model="phone"
type="tel"
placeholder="Mobile phone" 
pattern="[0-9\+]+" title="Phone number - allowed symbols are (0-9 and +)" />

If the pattern does not match it will throw the title.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda