Uncaught TypeError: m.css is not a function in V4.0.2
See original GitHub issueI upgraded from 4.0.1-rc.1 to 4.0.2 but now I get the following error :
Uncaught TypeError: m.css is not a function @ select2.min.js:2
It happens on all browsers and OS’s, I’ve got jQuery v1.11.3.
This is my code to call the select2:
var $brandSelector = $('#brand').select2({
ajax: {
url: function(params){
return '/api/brands';
},
dataType: 'json',
delay: 250,
processResults: function (data, params) {
var select2Data = $.map(data, function (obj) {
obj.text = obj.name;
delete obj.name;
return obj;
});
return {
results: select2Data
};
},
cache: false
},
language: appLocale,
escapeMarkup: function (markup) { return markup; },
placeholder: '{{trans('main.brand')}}',
minimumInputLength: 1,
dropdownParent: "#compareTab",
templateResult: formatBrands,
templateSelection: formatBrandSelection
});
Did I do something wrong? Thanks in advance!
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Uncaught TypeError: div.css is not a function [duplicate]
After running the codes above it will throw an error: Uncaught TypeError: div.css is not a function . Why? javascript · jquery ·...
Read more >Installation | Select2 - The jQuery replacement for select boxes
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.
Read more >(0 , react__webpack_imported_module_0__.usehistory) is not ...
What is the current behavior? Webpack production build creates a file which gives the following error: Uncaught TypeError: (!0) is not a function...
Read more >Angular 7 Upgrade: "TypeError: System.config is not a function"
So I changed to 0.21.5 and the "not a function" error disappeared. The browser now showed it was processing the loading information in...
Read more >"css is not a function" - jQuery Forum
css("display","block"); //Error: "ptCopyX.css is not a function." }); }); I feel like the solution will be really obvious, but I'm stuck.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Does this mean that it cannot be given as a data-* attribute in the HTML? 😦
If you could get us the stack trace that is triggered when you are using the non-minified build of Select2. The stack trace for the minified build is pretty much useless, because it hides pretty much all of the debugging information.
My guess is that you need to pass in
dropdownParent
asdropdownParent: $('#compareTab')
, because Select2 is most likely expecting the parent to be a jQuery/DOM object.