Wordpress, delay JS after template render

90 views Asked by At

I have some <script type="text/template">...</script> in a Wordpress website which is new to me and found out it is related to Underscore.js (?). However I am not familiar with it.

How can I execute a javascript function after the rendering of that (or all the) template, after the dom has been updated and elements can be found using document.querySelector('...')?

I tried the usual

document.addEventListener('DOMContentLoaded', function () {...})
jQuery(document).ready(function() {...})

but they execute too early when the template was not yet rendered in the page.

0

There are 0 answers