question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bind button value

See original GitHub issue

Html button element can have name & value attributes. If multiple buttons present in the html form the only value of the pressed button will be sent to the server. In this case, multiple buttons work like radio buttons. I imagine it’ll be nice if we’ll be able to do this with Svelte:

<button name="plan" value="free" bind:group={plan}>Free</button>
<button name="plan" value="startup" bind:group={plan}>Startup</button>
<button name="plan" value="enterprise" bind:group={plan}>Enterprise</button>

What do you think about?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
constgencommented, Jul 20, 2019

Looks like a custom ToggleSwither component that usually is implemented in UI libraries or by yourself. So it should not be a part of Svelte as it provides only what exists in pure HTML

0reactions
constgencommented, Aug 3, 2020

You can. If you use a custom component and not native HTML element that doesn’t support it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - how to bind value on button click with [(ngModel)]
i want to bind the value whichever button user selects. Suppose if button1 clicks, it should bind ngmodel i.e updateId with "U-001".
Read more >
The "value" binding - Knockout.js
The value binding links the associated DOM element's value with a property on your view model. This is typically useful with form elements...
Read more >
Bind Button Value in Form Field - WordPress.org
Am using Elementor Pro, facing issue to get button id in elementor form text field. Here I want when someone click on any...
Read more >
Value Binding - Kendo UI MVVM - Documentation
The value binding keeps the value of a DOM element or widget and the value of a View-Model field in sync. When the...
Read more >
Form Input Bindings - Vue.js
But sometimes we may want to bind the value to a dynamic property on the current active instance. We can use v-bind to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found