Help! JavaScript code not running.

I’m new to Wix and I’m trying to learn the platform but I’m running into some issues with adding JavaScript code to my pages. I can’t even get a message to log to the console. Any ideas on how to enable javascript code on my site?

I added this code to the main site to see if any messages would appear in the developer console, but I’m not seeing anything being logged.

$w.onReady(function () {
//TODO: write your page related code here…
console.log(‘test’);
});

Hi,
Can you please share a link to your site so we can inspect ?
Roi

Roi,
I’m just running the site in preview mode and not in a published site, so I’m not sure about how to share that with you. It looks like when I publish the site, the javascript code does run and I see the logs in the developer console, but I’d also like to see those logs in the unpublished site in preview mode for testing purposes. Any ideas on why the js code would not be running in preview mode?

Hi,
Pease share a link to the editor. Note that it is only accessible by Wix employees.
Roi

Roi, this is a link to the editor for my site:

Hi Ricardo,
It runs the console.log.


Am I missing something ?
Roi

I am also having issues with Javascript, this is just a simple widget, yet it does not want to load. Any help or insight is appreciate. The code is as follows…

Hi,
Try to use HTML Component.
For more information:

Roi.