【问题标题】:Caja / Apps Scripts jQuery $(document).ready not firingCaja / Apps Scripts jQuery $(document).ready 未触发
【发布时间】:2014-10-22 15:18:38
【问题描述】:

我在 Apps Scripts 中有一个项目,我的 $(document).ready 中的代码永远不会被执行。我还在http://caja.appspot.com/ 尝试了这个基本代码,但它也不起作用。

<html>
  <head>
   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script>
    $( document ).ready(function() {
      $("span").text("Working");
    });
    </script>
  </head>
  <body>
   <span>Not Working</span>
  </body>
</html>​

显示“不工作”文本。还尝试使用 jQuery 版本 2.x.x

有什么想法吗?

谢谢

【问题讨论】:

    标签: google-apps-script google-caja


    【解决方案1】:

    如果您使用稍旧的 jQuery 版本,这将有效。

    <html>
      <head>
       <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script>
        $(document).ready(function(){
          $("span").text("Working");
        });
        </script>
      </head>
      <body>
       <span>Not Working</span>
      </body>
    </html>
    

    我不知道为什么,因为文档说 Caja 适用于所有最新的 jQuery 版本:https://developers.google.com/apps-script/guides/html/restrictions#jquery_and_jquery_ui

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多