Last active
August 16, 2016 21:03
-
-
Save omariosouto/2c7eca7136fd463268f9b8fa36b1dc01 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| down vote | |
| accepted | |
| You could do it as follows: | |
| <div data-myattr="hello"></div> | |
| function countUp(){ | |
| console.log('hello'); | |
| } | |
| function executeFunctionFromData(){ | |
| var d = 'countUp' // Save `data-myattr` to d; (Obviously, this is just a hardcoded value as an example) | |
| window[d](); // Execute the function. | |
| } | |
| <div data-in="countUp" data-type="function" data-number="300" data-delay="1000" data-duration="2s"> | |
| </div> | |
| <script> | |
| function countUp(number, delay, duration) { | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment