admin管理员组

文章数量:1022553

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

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

本文标签: javascriptSpring boot and Thymeleaf application jquery is loading but not executingStack Overflow