Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading Jquery UI before Jquery

Tags:

jquery

When I load JQuery UI before JQuery, my script does not function at all. For example

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.js"></script>

The above would not work. But this would work

<script src="http://code.jquery.com/jquery-2.0.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Why is this?

like image 415
Leon Helmsley Avatar asked Dec 26 '22 21:12

Leon Helmsley


1 Answers

Because jQuery UI need jQuery library.

See in error log, $ is undefined, because they are not functions like funcName() but jQuery functions $.funcName() with other jQuery functions required.

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Now load jQuery. But error is still from UI.

<script src="http://code.jquery.com/jquery-2.0.3.js"></script>
like image 113
m1k1o Avatar answered Jan 12 '23 00:01

m1k1o