Stimulus Discourse

How can an element respond to multiple events


#1

Say I want an li to respond to dragstart and drop events. I want to be able to do something like:

<li data-action='dragstart->dragdrop#drag,drop->dragdrop#drop'>Some Text</li>

Or would I need another element as the drop target?

Thanks.


#2

Separate the action descriptors with a space. Just like CSS class names.

<li data-action="dragstart->dragdrop#drag drop->dragdrop#drop">Some Text</li>

#3

Of course! Thanks so much!