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

137
Vistas
input field that only contains numbers and no zeros

This question and its answers have been closed.

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

0

Try this

<input type="number" min="1" step="any" />
about 4 years ago · Juan Pablo Isaza Denunciar

0

With regex you can use that:
^[^0]\d+" And add the rest of your usage, this will avoid 0 being in the begining. [^] match any character that is not in the set - so putting 0 inside will avoid the first char to be 0 (with [^0]).

about 4 years ago · Juan Pablo Isaza Denunciar

0

class Example extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      financialGoal: ''
    }
  }
  
  handleChange(evt) {
    const financialGoal = (evt.target.validity.valid) ? evt.target.value : this.state.financialGoal;
    
    this.setState({ financialGoal });
  }
  
  render() {
    return (
      <input type="number" pattern="[0-9]*" min="1" step="any" onInput={this.handleChange.bind(this)} value={this.state.financialGoal} />
    )
  }
}
  
ReactDOM.render(<Example />, document.body);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

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