Skip to content

Instantly share code, notes, and snippets.

@Kadreev
Created June 20, 2022 21:00
Show Gist options
  • Save Kadreev/d21ac05210e4a369cf8e88cec1f63e77 to your computer and use it in GitHub Desktop.
Save Kadreev/d21ac05210e4a369cf8e88cec1f63e77 to your computer and use it in GitHub Desktop.
AlpineJS Select Tag
// vim: syntax=javascript
<div x-data="{foo :'not selected'}">
<select @change="foo = $event.target.value">
<option x-bind:value="1">option 1</option>
<option x-bind:value="2">option 2</option>
<option x-bind:value="3">option 3</option>
</select>
<span x-text="'option '+ foo"></span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment