modern-now

Back

Command

Inspired by invokers, execute command or dispatch events on html nodes.

Define a data-cmd command that can be an original function on the element or an event name. This will target any node matching data-cmd-for that can be a selector starting with # or . or just a plain id.

You can pass extra arguments to the event using data-cmd-args that following simple params notation.

Demo

This is my node
This is another node

Check the console!