[jQuery] jQuery(document).ready() Type error on WebKit based Browsers

[jQuery] jQuery(document).ready() Type error on WebKit based Browsers


Hi there,
I searched the internet for hours but couldn't find a solution which
worked for me. I use jQuery to call a Perl-Module which outputs an XML
File with all the Pictures in a specified Folder, which in turn is
interpreted by jQuery to show a preview of that same Folder.
It all works fine on Firefox, it works with some yet-unattended Bugs
on IE7, but on Safari and Opera (and all WebKit based Browsers for
that matter) it simply refuses to work. Both tell me that I have a
Type mismatch.
Code:
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery("#dir").change(function () {
if (jQuery("input[name=mode]:checked").val() ==
"add_from_folder") {
jQuery("#preview").hide();
jQuery("select option:selected").each(function ()
{
jQuery("#preview").empty();
requestXML();
jQuery("#preview").slideDown("slow");
})
}
})
.change();
jQuery("input[name=mode]").change(function(){
if (jQuery("input[name=mode]").val() == "add_blank") {
jQuery("#preview").empty();
jQuery("#preview").hide();
jQuery("#dir").attr("value",";-;");
} else {
jQuery("#dir").attr("disabled", false);
}
})
.change();
});
function requestXML() {
jQuery.ajax({
type: "GET",
url: "/cgi-bin/apps/load_preview?directory=" + jQuery
("#dir").val(),
dataType: "xml",
success: function(xml) {
jQuery(xml).find("picture").each(function(){
jQuery("#preview").append("<img class='preview'
src='/" + jQuery(this).find("reference").text() + "' />")
})
}
});
}
##Code end
I know there are things that could be made more efficient but I am
still new to Ajax and jQuery and learned how to use it just yesterday,
so I accept any constructive criticism :)