jQuery doesn't return any elements with ticker

I can’t seem to select anything in my ticker with jQuery or native Javascript. The following have returned no results:

$(“td”).length;
document.getElementById(“content”);
document.getElementsByClassName(“event-title”);

Elements of those types I’m attempting to select definitely exist. I have tried doing this through the ticker Javascript box on the advanced tab using both alerts and console.log as well as directly into the console in Safari. The javascript is executing just doesn’t return anything.

I’m using the preview function so I can see my layout displayed in a browser. Is this not supported? Do I have to load it up in a true player? Doesn’t make sense to me since I can see the javascript in the code, and the elements, but for some reason it won’t return anything when I try to select them.

Am I missing something?

Rookie mistake on this one. Elements were not loaded yet, needed to surround statements with:

$(document).ready(function() {
statements to execute
});

I think I made the assumption that Xibo was adding this into a section that already had the document.ready statement. However, I realized that Xibo literally just drops the statements into a script tag at the bottom of the document (which is enclosed in an iframe). Because it’s at the bottom of the document it seems like the other elements should be loaded, but putting within the document.ready clause ensures all elements referenced will be loaded.

Hope this helps someone else.

Thanks for posting this, it solved my problem!