Closed cssmagic closed 9 years ago
An easy and lazy solution for click-event-binding. Step 1
An easy and lazy solution for click-event-binding.
Define some actions:
action.add({ 'my-action': function () { //do something... }, ... })
Create an element like this:
<button data-action="my-action">btn</button> <!-- or --> <a href="#" data-action="my-action">link</a> <!-- or --> <a href="#my-action" data-action>link</a>
You've done everything.
Clicking the element will trigger the action you defined.
Summary
Define some actions:
Step 2
Create an element like this:
Step 3
You've done everything.
Clicking the element will trigger the action you defined.