-
|
Hi Is it possible to pass the value of a property to a script (javascript) added on html page? Let's say I have a And I want to use that 'message' property value inside the following code: (this code doesn't work) Codepen : |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Using expressions in However, you can define global functions in JS, and then call them in Mavo expressions, which is typically the easiest way to pass property data to JS. HTML attribute event handlers (e.g. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @LeaVerou I've been able to use it with onclick, but not defining a JS function inside my own JS file, or even inside my HTML page Do they need to be written inside mavo.js file? Is there a demo somewhere about defining a global function that can be used by Mavo? |
Beta Was this translation helpful? Give feedback.
-
|
Wow ! , I even don't understand where I was wrong.... Thank you so much Dmitry |
Beta Was this translation helpful? Give feedback.
Using expressions in
<script>tags wouldn't work, because by the time Mavo resolves the expressions, the browser has already tried to execute the script.However, you can define global functions in JS, and then call them in Mavo expressions, which is typically the easiest way to pass property data to JS. HTML attribute event handlers (e.g.
onclick) also work.