Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

The select2('val') method was called on an element that is not using Select2 #301

Open
dincoo opened this issue Jul 7, 2016 · 4 comments

Comments

@dincoo
Copy link

dincoo commented Jul 7, 2016

is my configure error?
TypeError: Cannot read property 'val' of undefined

@ralphdev22
Copy link

ralphdev22 commented Jun 27, 2017

I have reset button on my form. In my reset function, i put this $('.select2').select2("val", ""); so that the my select2 input will be reset too. but there's an error.

The select2('val') method was called on an element that is not using Select2.

Please help?????

@kolte
Copy link

kolte commented Oct 25, 2017

I am facing the same issue, any idea?

@DhirenGangal
Copy link

DhirenGangal commented Jul 14, 2018

Make sure to any script call while on change event.
If yes then make sure it properly work or not.

@beta1007
Copy link

beta1007 commented Sep 6, 2018

Update the js to look for class name before destroy.

elm.bind("$destroy", function () {
if (elm.hasClass('.select2-offscreen')) {
elm.select2("destroy");
}
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants