简体   繁体   English

jQuery Google应用引擎

[英]jquery google app engine

I have an issue where the Javascript file that I have uploaded does not work. 我有一个问题,我上传的Javascript文件不起作用。 My code is below. 我的代码如下。

app.yaml has: app.yaml具有:

- url: /js
  static_dir: /js

index.html has: index.html具有:

<script type="text/javascript" src="/js/script.js"></script>

script.js has: script.js具有:

$(document).ready(function(){
   $('img').click(function(){
       $(this).fadeOut('slow');
   });
   $('p').click(function(){
       $(this).fadeOut('slow');
   });
   alert("hi");
});

and not even the alert comes out 甚至没有警报发出

You need to import jquery. 您需要导入jquery。 Try this fiddle 试试这个小提琴

 $(document).ready(function() { $('img').click(function() { $(this).fadeOut('slow'); }); $('p').click(function() { $(this).fadeOut('slow'); }); alert("hi"); }); 
 <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="/js/script.js"></script> </head> <img src="http://www.w3schools.com/images/w3schools.png"/> <p>Click Me</p> 

我认为您的src="/js/script.js"不正确尝试:

 src="js/script.js"

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

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