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

84
Visualizações
Can Svelte select elements contain buttons?

I'm trying to insert buttons into select items such as this. I'd like each element to have a button so that a different action can be taken if the button is clicked, such as removing that item from the list. If I put the code for the button in the label field then the button shows up but it doesn't handle the on:click directive.

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

0

No you can't do this.

This library expects the value to be a string, at most a html script for some extra styling, but you cannot add interactions like that.

The code you have is similar to do doing:

<script>
  const str = "<button on:click={console.log}>click me</button>"
</script>

{@html str}

While this will render a button Svelte will not add the event handler to this, but rather just render the string as you gave it (in face if you inspect the rendered markup you will still the on:click written there)

about 4 years ago · Juan Pablo Isaza Relatório

0

first try css , test peroperty z-index: 9999; for close button .

if css peroperty not working try to console.log('someting') if close button with click event in javascript ; and if you got console.log('someting');

now you can write fucntion to close your item;

i hope i can alitel help;

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