{"id":18268416,"date":"2025-01-27T19:05:44","date_gmt":"2025-01-27T19:05:44","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/javascript-wont-trigger\/"},"modified":"2025-01-27T19:06:46","modified_gmt":"2025-01-27T19:06:46","slug":"javascript-wont-trigger","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/javascript-wont-trigger\/","title":{"rendered":"Javascript won&#8217;t trigger"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Do you know why my javacript doesn&#8217;t trigger when i add it to the header of my page? It appear normaly in the source code and work in a local environment (or in a html environement), by in my server with WordPress it&#8217;s block by something. Thanks for your help.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.5.1\/jquery.min.js\"&gt;&lt;\/script&gt;<br \/>&lt;script type=\"text\/javascript\"&gt;<br \/>$(document).ready(function(){$('#click').click(function(){<br \/>window.location.href = 'https:\/\/MyURL.com';});<br \/>setTimeout(function(){$('#click').trigger('click');}, 2000);});&lt;\/script&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-18268416","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18268416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18268416\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18268416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}