繁体   English   中英

jQuery无法在wordpress的footer.php文件中工作?

[英]jQuery not working inside the wordpress's footer.php file?

我必须将这些代码包含在wordpress的footer.php文件中,但无法正常工作,

<script type="text/javascript">
    jQuery('#vpb_captcha_code_102').blur(function(){
       var value= jQuery('#vpb_captcha_code_102').val();
      alert(value);
  });
</script>

而如果我尝试从控制台运行相同的代码,那么它可以工作,请告诉我该怎么办。

在文档"ready."之前,无法安全地操纵页面"ready." jQuery为您检测到这种就绪状态。

请按以下方式更改代码:

<script type="text/javascript">
jQuery( document ).ready(function() {
    jQuery('#vpb_captcha_code_102').blur(function(){
       var value= jQuery('#vpb_captcha_code_102').val();
      alert(value);
  });
});
</script>

https://www.w3schools.com/jquery/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM