$w is not defined

I have created custom html+js slidebar using noUiSlider (js library) , inside HTML code block.
It works correctly, everying is ok.
Then I wanted to add a text block, representing a value of this slider.
This library has an onUpdate event, which is toggled obviosly on update of slider’s position.

Inside onUpdate function I wanted to use velo ($w) in order to send a message to my target text block. But unfortunatly I am getting a error.

This is what code looks like


Error is displayed in console


Any ideas how to make it work?

Wait… it should post to window.parent, you cannot use $w (wix element selector) inside HTML

To receive the event on the Velo code, you can use $w(“#html2”).onMessage()

Put into the site code, not HTML

Okkk…

Is there any possible workaround to let my slider trigger some code inside page code?

Or maybe any ideas how to recreate this using page’s js?

(From velo tab)