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

136
Vistas
How to open dropdown menu of select box in p5.js?

I need to open dropdown menu of select box without clicking on it, for example — with key pressed. For some reason click() works fine with other elements like file input, but cannot open dropdown list. Here is example:

https://openprocessing.org/sketch/1587950

function setup() {
  createCanvas(600, 250);       background(200);                                 // create canvas
  sel = createSelect();         sel.position(100,100);     sel.id('mySel');      // create select box
  inp = createFileInput(open);  inp.position(300,100);     inp.id('myInput');    // create file input
  for(let i=0; i<5; i++)      { sel.option(random()); }                          // create select box options
}

function keyPressed() {
  // open dropdown with left key - doesn't work
  if      (keyCode === LEFT_ARROW)  {    document.getElementById('mySel').click();    }  
  // open file dialog with right key - works fine
  else if (keyCode === RIGHT_ARROW) {    document.getElementById('myInput').click();  } 
}

function draw() {}          // empty
function open(file) {}      // empty 

Is there a way to open this dropdown, maybe without click()?

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