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

170
Vistas
Mobile Browser View Disable/Prevent entering white spaces inside input box using Javascript

The below code only working in web view, but not in mweb browser

onKeyPress={(e) => {
  var startPos = e.currentTarget.selectionStart;
  if (e.which === 32 && startPos == 0) {
      e.preventDefault();
  }
}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

(function()
{
  let inp = document.querySelector('input');
  inp.addEventListener('keyup', function(e)
  {
    e.target.value = e.target.value.trimStart();
  });
})();
<input type="text">

If you try to put a space at the start of the text box then it will be removed. In fact any whitespace will.

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