I have an external js file which works fine only if I imported the jQuery library in my aspx file but when I drag and drop the jQuery library directly to the external js file, my external js doesn't work.
What is the proper way to import the jQuery on external js file or should the jQuery library be imported only in aspx page? Please help me understand.
Below is my code
/// <reference path="Scripts/libframeworks/jQuery/jQuery-2.1.4.min.js" />
$(function () {
$("#btnSave").mouseover(function () {
$(this).css("background-color", "Red");
}).mouseleave(function () {
$(this).css("background-color", "Blue");
});
});
If I remove this
/// <reference path="Scripts/libframeworks/jQuery/jQuery-2.1.4.min.js" />
and import it directly to the aspx page this way
<script src="Scripts/libframeworks/jQuery/jQuery-2.1.4.min.js" type="text/javascript"></script>
my external js works fine. But I want to import jQuery library on my external js.