Skip to content

Instantly share code, notes, and snippets.

@bmihelac
Created July 26, 2022 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmihelac/1fda3bd253d3d3ec0c1f89a934c410dd to your computer and use it in GitHub Desktop.
Save bmihelac/1fda3bd253d3d3ec0c1f89a934c410dd to your computer and use it in GitHub Desktop.
<div x-data="{ count: 0, replaced: false,
message: 'Change me, then press the button!' }">
<input type="text" x-model="message">
<div x-text="count"></div>
<button x-bind:style="replaced && {'backgroundColor': '#fecaca'}"
x-on:click="replaced = true; count++"
hx-get="/swap">
Morph
</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment