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

165
Vistas
Set select value with Javascipt

I Want to set the selected value of a html select with the help of javascript. This is my current js code:

var g = document.getElementById('g');
g.value = '1';

While this is my select:

   <select id="g">
    <option value="" disabled selected>  Geschlecht...</option>
    <option value="1" id="M">Männlich</option>
    <option value="2" id="F">Weiblich</option>
  </select>

However this doesn't seem to work as i get the following error:

Uncaught TypeError: Cannot set properties of null (setting 'value')

about 4 years ago · Juan Pablo Isaza
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