Given the current CMS we work with, I need to call functions in a user data attribute. Is it possible to call the contents of a data attribute as a function to run, as shown below? A simple example:
Set
<button data-function="alert('hello world')">Run Function</button>
Run
$('button').attr('function');
I believe that the above simply receives the content and actually does nothing when writing.
Is it possible?
Myoji source
share