Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

stimulus data action

<div data-controller="gallery">
  <button data-action="click->gallery#next">…</button>
</div>
// controllers/gallery_controller.js
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  next(event) {
    // …
  }
}
Source by stimulus.hotwired.dev #
 
PREVIOUS NEXT
Tagged: #stimulus #data #action
ADD COMMENT
Topic
Name
6+7 =