Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
How to use Html Drag & Drop API with select element

I am working on a system which uses the HTML Drag & Drop API.

If I add the draggable="true" attribute to the select element, then it does not work as I expect. It is not draggable. When I try to drag it, it just opens the select dropdown. I could make it draggable by adding pointer-events:none to the CSS, but then the select element becomes unavailable.

I need to have the behavior like the standard input element. When I create an input element that has draggable="true" then I should be able to click it to write inside it, and I should also be able to press and hold down to drag it somewhere else.

Here is my code snippet:

<div>Works with input: <input type="text" draggable="true" /></div>
<div>
  Does not work with select:
  <select draggable="true">
    <option>Example Option</option>
  </select>
</div>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could wrap the select with a div and apply a small padding and then you would be able to drag the div, and/or you could put an icon within the div and then allow that to be dragged as well.

The emoji hand, ✋ &#9995;, is just for demonstration purposes.

Also if you apply cursor: grab to this div then it will be obvious to the user when the select can be dragged.

<div>Works with input: <input type="text" draggable="true" /></div>
<div>
  <div>
    Does not work with select:
    <div style="display:inline-block; padding:2px; cursor: grab ;" draggable="true">
      <select>
        <option>Example Option 1</option>
        <option>Example Option 2</option>
        <option>Example Option 3</option>
      </select>&#9995;
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda