最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Spring boot and Thymeleaf application: jquery is loading but not executing - Stack Overflow

programmeradmin2浏览0评论

I have created a simple spring boot application for my View is loading jquery but not executing it.Details are below: My Project structure

[

My Controller

My JqueryCode

My HTML page that import jQuery

Chrome Inspector shows jquery is loaded fine

But still my jQuery code is not running, and if I try running it directly from console., is says jQuery is not Defined

Guys please tell me what am i doing wrong / or missing.

I have created a simple spring boot application for my View is loading jquery but not executing it.Details are below: My Project structure

[

My Controller

My JqueryCode

My HTML page that import jQuery

Chrome Inspector shows jquery is loaded fine

But still my jQuery code is not running, and if I try running it directly from console., is says jQuery is not Defined

Guys please tell me what am i doing wrong / or missing.

Share Improve this question asked Jun 29, 2016 at 11:33 mohit sharmamohit sharma 1,08010 silver badges20 bronze badges 3
  • Could you post the generated HTML? Also, does this occur on other browsers? It looks like the JS resources all loaded fine, so is there anything in materialize.js that may be delaying the document from being ready and hence the exeution of the $(document).ready()? – Finbarr O'B Commented Jun 29, 2016 at 12:26
  • @FinbarrO'Brien generated HTML? do you want html page source – mohit sharma Commented Jun 30, 2016 at 5:11
  • @FinbarrO'Brien I also checked by removing materialize.js. Still same problem? Even if i don't import jquery lib and import my jquery code, it doesn't say $/jQuery not defined. It simply doesn't execute any js file or library – mohit sharma Commented Jun 30, 2016 at 5:14
Add a ment  | 

1 Answer 1

Reset to default 4

If you change the:

<script type="javascript"

to

<script type="application/javascript"

it should work, type='javascript' is not a defined media type according to http://www.iana/assignments/media-types/media-types.xhtml

发布评论

评论列表(0)

  1. 暂无评论