Select2 - Object does not support the method

1

I've downloaded JQuery select2 library, in order to use its Multiselect (looks like tags). I have an MVC application, framework 4.5, and I'm also using bootstrap. I've tried all kind of solutions, but out of some reason, my application falls on

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'select2'

Here's what I'v tried:
1)

$(document).ready(function () {
        var test = $('#test');
        $(test).select2({
            data: [
                { id: 0, text: "enhancement" },
                { id: 1, text: "bug" },
                { id: 2, text: "duplicate" },
                { id: 3, text: "invalid" },
                { id: 4, text: "wontfix" }
            ],
            multiple: true,
            width: "300px"
        });
    });

<input type="text" id="test" />

That's according to: JSFIDDLE

2) $(document).ready(function () { $("#test").select2(); });

                                    <select id="test" class="form-control">
                                        <option value="AL">Alabama</option>
                                        <option value="WY">Wyoming</option>
                                        <option value="XX">blabla</option>
                                    </select>

That's according to: JQuery page (Under Multi-Value Select Boxes, the one under Multiple select types)

I've tried some more which I can't remember, since I've been working on it for a day or so...

My References are to

select2.css
select2-bootstrap.css
bootstrap.css
jquery-1.10.2.js
select2.js
bootstrap.js

(In that order) The JQuery Select2 version is 3.5.1 I also tried using jquery-2.1.1.js instead of jquery-1.10.2.js, but it didn't work (same error).

Any ideas what am I doing wrong?

Thanks

jquery
twitter-bootstrap
asp.net-mvc-4
runtime-error
jquery-multiselect
asked on Stack Overflow Jul 28, 2014 by DA_Prog • edited Jun 29, 2015 by Siguza

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0