Tag-Handler icon indicating copy to clipboard operation
Tag-Handler copied to clipboard

jQuery error

Open denen99 opened this issue 11 years ago • 14 comments

using jquery 1.7.2 and jqueryUI when using the autocomplete option i keep getting the error

Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'option'

Any ideas what would cause this? I made sure jquery and jqueryUI were loaded first but still no luck.

denen99 avatar Oct 31 '12 17:10 denen99

I'm having the same problem with jquery 1.8.2 and jqueryui 1.9.2.

Renari avatar Nov 29 '12 10:11 Renari

I'm having the same problem with jquery 1.8.3 and jqueryui 1.9.2

javierdallamore avatar Nov 29 '12 18:11 javierdallamore

Even I am getting this error. Could anyone fix it?

manuganji avatar Dec 03 '12 12:12 manuganji

Have the same issue, downgrading to jquery ui 1.8.24 fixed it for me

PazkaL avatar Dec 06 '12 16:12 PazkaL

All right, apparently this is a common issue =)

I'll take a look at it this weekend then and see if I can fix it up for all versions of jQuery. Possibly just v1.6 and higher.

ioncache avatar Dec 06 '12 19:12 ioncache

There is no inicialization of autocomplete. Just add: $(inputField).autocomplete({ source: tags.availableTags }); before line 331 (and maybe similiar other lines).

ghost avatar Jan 09 '13 12:01 ghost

This seems specific to jQuery UI 1.9 branch.

Latest jQuery 1.8 with UI 1.8 works OK, but jQuery 1.8 with UI 1.9 is broken.

NoelLH avatar Jan 15 '13 11:01 NoelLH

@wshafer but it still do not work for me I am getting this error still Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'option' Capture

alok108 avatar Jan 30 '13 07:01 alok108

@alok108 - Sorry for the delay. I'm no longer getting the error. What does your initialization look like so I can recreate the problem on this end?

In other words how are you calling the tagger? $("#someSelector").tagHandler({ ?? })

wshafer avatar Feb 06 '13 15:02 wshafer

I've got same problem, jQuery: 1.8.0, jQuery UI 1.9.2

Initialization

$(document).ready(function () {
    $(".tag-food").each(function(key,tagInput) {
        tagInput = $(tagInput);
        $(this).tagHandler({
            assignedTags: tagInput.data('tags'),
            getURL: tagInput.data('getURL'),
            onAdd: function (tag) {
                }
                $.getJSON(tagInput.data('addurl'), { foodId: tagInput.data('foodid'), tag: tag });
            },
            onDelete: function (tag) {
                $(this).hide();
                $.getJSON(tagInput.data('deleteurl'), { foodId: tagInput.data('foodid'), tag: tag });
            },
            autocomplete: true,
            availableTags: [ 'C', 'C++', 'C#', 'Java', 'Perl', 'PHP', 'Python' ],
            minChars: 1
        })
    });
});

without autocomplete: true works fine.

pilec avatar Feb 13 '13 10:02 pilec

Thanks for the info. I tested using the same approach as above, and it worked for me. So couple of questions to see why it's working for me and not for you.

  1. Did you make sure to clone from my fork? The pull request that I sent to fix this has not been merged with the main repo. So you'll need to use mine.

  2. Are you using the minified version? If you are try the unminified version and see if it works with that one. I did not fix the minified version in my repo. I can, but I assumed that this would be corrected when the next version comes out and my changes are merged (or dumped).

Let me know if the above fixed it for you. If not I'll keep digging.

Thanks, Westin

wshafer avatar Feb 13 '13 15:02 wshafer

Oh, I use minified version, in unminified is everything okay. Thanks for help, you're doing a really good job!

pilec avatar Feb 13 '13 15:02 pilec

Awesome. It seems that is causing a bit of confusion. I'm going to minify my version and push that to the repo to keep this issue from coming up again. I'll let you know when the minified version is corrected.

Thanks for the feedback, Westin

wshafer avatar Feb 13 '13 15:02 wshafer

Hi, to clear all tags, i am resetting the tag handler like below

("#array_tag_handler").tagHandler({ assignedTags: asnTags, availableTags: avlTags, autocomplete: true});

it worked fine. But the problem with this is, when i add one of the available tag and deleting the same tag giving me the error like Uncaught cannot call methods on autocomplete prior to initialization; attempted to call method 'option'.

how to fix it?

rockrockrock3 avatar Dec 29 '15 19:12 rockrockrock3