user2359967
user2359967

Reputation:

Uncaught TypeError: Cannot read property 'plugin' of undefined

I'm using Jeditable plugin of Mika Tuupola with autogrowing. I've followed his indications but the console shows this error:

enter image description here

I'm using Symfony2 with fosjsroutingbundle; this is the reason for use the variable of editable. This works fine.

This is the JS code:

 $('.editarContenido').editable(Routing.generate('criContenido_ajax.' + $('html').attr('lang'), { "_locale": $('html').attr('lang'), "pysStr": $('section').attr('pelicula') }),
        { 
            type      : "autogrow",
            submit    : 'OK',
            indicator : 'Saving...',
            tooltip   : 'Click to edit...',
            autogrow : {
                lineHeight : 16,
                maxHeight  : 512
            }
        });

        $.editable.addInputType('autogrow', {
            element : function(settings, original) {
                var textarea = $('<textarea>');
                if (settings.rows) {
                    textarea.attr('rows', settings.rows);
                } else {
                    textarea.height(settings.height);
                }
                if (settings.cols) {
                    textarea.attr('cols', settings.cols);
                } else {
                    textarea.width(settings.width);
                }
                $(this).append(textarea);
                return(textarea);
            },
            plugin : function(settings, original) {
                $('textarea', this).autogrow(settings.autogrow);
            }
        });

EDIT

enter image description here

Upvotes: 1

Views: 15940

Answers (2)

Patrick McCarthy
Patrick McCarthy

Reputation: 57

I had the same problem and it was because I had applied 'async' to the tag. I remove async and everything worked fine.

Upvotes: 0

Uku Loskit
Uku Loskit

Reputation: 42030

The error indicates that you do not have jQuery in place or it is placed in the HTML document after the jEditable plugin.

Make sure your scripts tags are sorted just like in the source code of this page: http://www.appelsiini.net/projects/jeditable/custom.html and all of them are properly loading.

Edit: regarding your new error: you will have to use an older version of jQuery than 1.9, as browser detection was removed beginning with that version.

Upvotes: 1

Related Questions