JQuery就绪功能无法在wordpress中运行

问题描述 投票:0回答:3

我在wordpress中排队js文件并加载文件并使用本机js代码但jQuery准备好无法正常工作

 alert('working');  
jQuery(document).ready(function(){  
   alert('not working');  
});  

网站网址 http://typingbooster.expotech.co.in/ 请查看源文件custom.js

jquery wordpress
3个回答
1
投票

在wordPress环境中,使用:

jQuery(document).ready(function($){

});

0
投票

你确定jQuery已经入队吗?您可以通过将其添加到您的functions.php来确保它:

add_action('init', 'load_jquery_scripts', 0);
function load_jquery_scripts() {
	wp_enqueue_script('jquery');
}

0
投票
window.addEventListener("load", function(){
    alert('works');
});

希望这对你有用!

© www.soinside.com 2019 - 2024. All rights reserved.