Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!