onClick/ onMousein/out only works in preview, not published

So I spent 6 hours working on a page today that works fine in preview, when it’s published onClick/ onMouseIn/Out export functions don’t work at all! The only thing working in Corvid is what’s contained within $w.onReady( function ()

Here’s what I’ve ruled out:

I haven’t got any data sources on the page so it’s not a permissions or sync issue.
All onClick and mouseIn/mouseOut events are registered using the + icon in properties

Here’s an example of my code:

export function PlanSelectorFree_mouseIn(event) {
$w( ‘#PlanSelectorFree’ ).style.backgroundColor = “#D9FBFF” ;
}

export function PlanSelectorFree_mouseOut(event) {
$w( ‘#PlanSelectorFree’ ).style.backgroundColor = “#F3F3F3” ;
}

Hello Rick,

which element is this —> $w( ’ #PlanSelectorFree ’ ) ?

Hi This is a container box.

Hello again,

you have to set the ALPHA-value to 100%, then it should work.
Or take a look here…
https://russian-dima.wixsite.com/meinewebsite/home

Sorry, this tutorial is still under construction, but you shuold see, how it works.

Hi

Thank but I’ve found the issue - there were onClick functions which were not exported, this caused the CORVID to stop working outside of Wix Preview.

The error I received on Developer Tools was:
The element selector function (usually $w) cannot be used before the page is ready

On further inspection I found that I created functions without putting export before. Adding export fixed the issue.

Before:

function ydfSelectPlan(planID,planName,planStorage) {

Afrer:

export function ydfSelectPlan(planID,planName,planStorage) {

Hi :raised_hand_with_fingers_splayed:

Make sure you’re turning the page caching OFF , then try again.
Or try the page using Incognito mode to test the page.