Where to put Javascript that will load after the DOM?


(Steven Slade) #1

Hola,

I have this code:

$('#topic-title .badge-wrapper').first().text();

That I would like to put into a variable after the page has loaded. In the Discourse UI, you cannot put Javascript in the Footer and if you place it in the header or body under customize, it will not work because the DOM has not loaded.

I cannot use document.ready because it is for a google adwords param that will not work inside that.

So, where to put Javascript that will run after the DOM has loaded in Discourse?