Skip to content

Instantly share code, notes, and snippets.

@zachwill
Last active August 3, 2025 15:23
Show Gist options
  • Save zachwill/c0f52d6dfe46ccdaf549b058ef34922a to your computer and use it in GitHub Desktop.
Save zachwill/c0f52d6dfe46ccdaf549b058ef34922a to your computer and use it in GitHub Desktop.
<!-- 1. First select binds its value to a new signal named 'category' -->
<!-- On change, it hits the /options endpoint, targeting the #subcategory -->
<select name="category"
data-bind="category"
data-on-change="@get('/options')">
<option value="">Select a Category...</option>
<option value="fruits">Fruits</option>
<option value="vegetables">Vegetables</option>
</select>
<!-- 2. This container will receive the HTML from the backend. -->
<div id="subcategory">
<!-- The backend will populate this -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment