Reputation: 119
i have the following code
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%:ResolveUrl("~/Content/JS/jquery.ddslick.min.js")%>" ></script>
and
$(function () {
var dropdownlist = [
{
text: "RO",
value: 1,
imageSrc: "~/Images/icon-romanian-flag.png"
},
{
text: "EN",
value: 2,
imageSrc: "~/Images/icon-english-flag.png"
}
];
$("#dropd").ddslick({
data: dropdownlist,
width: 200,
imagePosition: "Left"
});
});
and
<div id="dropd"></div>
I get the following error:
Uncaught TypeError: $(...).ddslick is not a function
I am trying to build a dropdownlist with two values for two languages.
Upvotes: 0
Views: 1398
Reputation: 51
So I had the same problem and it was because of the order of loading the javascript files, in my case since I am using angular.js and jquery, I had to load these .js files first, load the ddslick.min.js second, and then my controller.js file.
Try rearranging the javascripts loading.
Happy coding!
Upvotes: 1
Reputation: 143
Its mostly because the script file has not be loaded.
Try using this:
<script type="text/javascript" src="https://dl.dropboxusercontent.com/u/40036711/Scripts/jquery.ddslick.min.js"></script>
Instead of:
<script type="text/javascript" src="<%:ResolveUrl("~/Content/JS/jquery.ddslick.min.js")%>" ></script>
Upvotes: 0