Chatbox Not A Valid Selector

export function button3_click(event)
{
 if($w("#LiveChat").maximized) 

    {
        $w("#LiveChat").minimize();
    }
 else
    {
        $w("#LiveChat").maximize();
    }
}

Hello, I am getting the error: ‘#LiveChat’ is not a valid selector.
The code isn’t working in preview mode or on the live site.
All of the ID’s match up. What am I doing wrong here?
The code is located on the homepage as that is where the button is located.
I would like button3 to be clicked and open up the LiveChat.

Hi Thomas

This answer is a little late I guess, but maybe it helps some other people: If you want to select the Wix Chat Element in Wix Velo you have to do this in the “masterPage.js”, since it is a global element.

1 Like