Dynamic.js Extras demo
Dynamic.js is a small library that allows binding simple behaviours to DOM elements using data- attributes.
See the main Dynamic.js project docs here.
I copy the value when clicked based on a JSON config
Add/remove class on click based on data attributes
I may be green
I set a class when changed based on a JSON config with an expression
I have the selected class applied!
Hiding and showing an element
I am visible!
Setting the text of an element
Initial text
Preventing the default action
Not going anywhere, as the default action was prevented
Toggling text
Copying HTML
My text
My HTML to copy