appendTo and other dom manipulators problems in IE7/IE8
I've a strange behaviour with jquery ui autocomplete and IE7/8. The de开发者_StackOverflowfault behaviour of autocomplete is to create a UL and append it to the BODY of the page. In my case i want to append this UL to the DIV that also has the INPUT (where the autocomplete is triggered). So i've done this:
(function($) {
$.widget("ui.combobox", {
_create: function() {
var select = this.element.hide();
var outerDiv = $("<div>")
.insertAfter(select);
//Autocomplete code...
.
.
$('body').children('ul.ui-autocomplete').appendTo(outerDiv);
}
});
})(jQuery);
This works fine on Firefox/Chrome, but IE7/8 doesn't append the UL to to the outerDiv, it just lets the UL appended to the BODY of the page. I solved my problem, by actually passing the
$('body').children('ul.ui-autocomplete').appendTo(outerDiv);
to the outside of the function, but i would like to do it in a more elegant way :-)
Thanks in advance.
精彩评论