Tag-Handler
Tag-Handler copied to clipboard
jQuery error
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.
I'm having the same problem with jquery 1.8.2 and jqueryui 1.9.2.
I'm having the same problem with jquery 1.8.3 and jqueryui 1.9.2
Even I am getting this error. Could anyone fix it?
Have the same issue, downgrading to jquery ui 1.8.24 fixed it for me
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.
There is no inicialization of autocomplete. Just add: $(inputField).autocomplete({ source: tags.availableTags }); before line 331 (and maybe similiar other lines).
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.
@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'
@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({ ?? })
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.
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.
-
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.
-
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
Oh, I use minified version, in unminified is everything okay. Thanks for help, you're doing a really good job!
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
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?