Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
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 Respuestas
Responde la pregunta

0

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

Example here

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda