Jquery plugins won't work

723 Views Asked by At

This script in yellow marker I'm using to chain two or more select inputs, an it won't work if this code bellow (green marker) is there. That in green marker I'm using for imageareaselect (cropping images), and it won't work if this silver code in footer is there. That in footer I'm using for datepicker. Any solution?

Picture here:

enter image description here

1

There are 1 best solutions below

0
martynas On

I successfully solved this problem. I downloaded another script for imageareaselect from odyniec.net/projects/imgareaselect/#download and load them in footer.

Well, you did not solve the problem - you just bypassed it :)

jquery.chained.min.js won't work if i don't load jquery in head, same thing in footer, datepicker won't work if i don't load jquery in footer. Im not getting errors. If I delete this imageareaselect scripts (green marker) everything will work, but I need imageareaselect

You pretty much answered the question yourself. You had to main problems:

  • You loaded jQuery twice (don't do it, unless you are going to use .noConflict() and use different versions of jQuery)
  • You were loading jQuery either too early or too late. You must load jQuery before all other plugins that depend on it.

The solution is rather simple:

HTML:

<html>
<head>
    <!-- Put CSS stylesheets in head -->
    <link rel="stylesheet" type="text/css" href="../css/imgareaselect-default.css">
</head>
<body>
    <!-- Your content -->

    <!-- Put JavaScript files at the bottom for better performance -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="../js/jquery.chained.min.js"></script>
    <script type="text/javascript" src="../js/jquery-pack.js"></script>
    <script type="text/javascript" src="../js/jquery.imgareaselect.min.js"></script>
    <script type="text/javascript" src="../plugins/datepicker/bootstrap-datepicker.js"></script>
</body>
</html>