jQuery not detected in Play Framework application

2019-07-30 16:23发布

I'm not able to use jQuery/jQuery UI on my Play Framework application. I have included all the necessary stylesheets and js files. The page loads properly but Firebug error console shows Jquery Undefined. I cannot understand what's wrong here. Any ideas?

3条回答
放我归山
2楼-- · 2019-07-30 17:03

You need to include your jQuery- and jQueryUI-files on your page. How does your <script>-tags look in your <head>-section of your page?

查看更多
Fickle 薄情
3楼-- · 2019-07-30 17:07

JQuery is included by default in the main.html, which if you have extended the skeleton code that is created when you create a new play application, it is possible by adding your own script tags for jquery and jquery-ui, they are conflicting with the version already included?

查看更多
做个烂人
4楼-- · 2019-07-30 17:10

Actually looks like a syntax error.

Are you using this syntax ?

$(function() {
    // Code
});

Plus if you try to include a file in play that does not exist if there is an error, play will display an error and not launch application. Makes me think, you are using jQuery the wrong way.

Checkout jQuery documentation and make sure, this is not a jQuery related issue.

查看更多
登录 后发表回答