Hi experts :)
Can you please tell me how to add java script execution by pressing a button?
A third party service gave me this code:
Code to call quiz (Dialogue version)
<script>
(function () {
new enquiz_ioLoader({
quiz_hash:"vasszsj",
type: enquiz_ioLoader.FLOAT,
button: "YourButtonId",
hash: "quiz_vasszsj"
})
})()
</script>
To call the dialogue you need one of two things:
- Replace YourButtonId with the ID of the button that will open the quiz window
- Specify the link for the button: #quiz_vasszsj
I'm a noob, so could you give me a step-by-step guide, how to connect?
Well it seems that you only gave us half the info.
You can build it into the site without a button or through a button link and it does give you two versions of the code.
It does say on the instructions that you need to enter code into the head section too.
Something like this:
<script type="text/javascript" src="https://show.enquiz.io/js/quizloader.js"></script>
To do that you will need to add a new tool in tracking and analytics and make sure that you place it into the head section.
https://support.wix.com/en/article/about-tracking-tools-analytics
Then you can add your code again without button parts for built into site:
CHECK THIS IS CORRECT FROM YOUR SUPPLIED CODE:
<script> (function () { new enquiz_ioLoader({ quiz_hash:"vasszsj", }) })() </script>
Or add your full code as before for your button version:
CHECK THIS IS CORRECT FROM YOUR SUPPLIED CODE:
<script> (function () { new enquiz_ioLoader({ quiz_hash:"vasszsj", type: enquiz_ioLoader.FLOAT, button: "YourButtonId", hash: "quiz_vasszsj" }) })() </script>
And add a button for it and make sure that your button id name in the properties panel matches exactly the button id that you insert into the code.
So for example, if your button is called button24 or quizButton, then button24 or quizButton must be added to the code
Add an html iframe to your page and paste that code into it.
https://support.wix.com/en/article/adding-html-code
https://www.youtube.com/watch?v=VZEuDtfb30E
Add a button and call it whatever you want and then place the name of the button into the code.
https://support.wix.com/en/the-wix-editor/button