Hi guys,
I need some help. but before that let me tell you im not a pro dev. So i may ask really dumb questions.
In the most simplest question, can I transfer a hubspit varaible data to a jquery varaible and how i go about doing that?
I treid searching and i couldnt find anything. Any help would be appreciated
Anton
April 17, 2020, 12:12pm
2
Hi @peterifranco ,
do I get you right that you want to have the ability to insert things with - lets say a custom module into jquery?
If yes you can do it like this:
1. create a new module
2. paste your jquery code with <script>-tags into the “HTML+Hubl” section
3. create a widget like text in the right sidebar
4. copy just the “value” of the widget
5. paste it into the desired place inside your jQuery code
Here’s an example:
I’ve created a widget with the name “duration” and replaced the regular duration with it
you might have to modify the copied value tag.
so that you’ll have
{{ module.duration.value }}
instead of just
{{ module.duration }}
Furthermore you can use any of the filters, variables which can be found here
best,
Anton
Hey @peterifranco
@Anton 's answer works perfectly! I just wanted to ad yet another option.
@amwilie recently answered another question and the solution might be something you could implement. She used HUBL to add data to the window object, from which it can be accessed anywhere on the page.
Check it out here