question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: m.css is not a function in V4.0.2

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gabn88commented, Jul 4, 2016

Does this mean that it cannot be given as a data-* attribute in the HTML? 😦

3reactions
kevin-browncommented, Apr 10, 2016

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 as dropdownParent: $('#compareTab'), because Select2 is most likely expecting the parent to be a jQuery/DOM object.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found