Javascript functions don't work in IE8 when passed as parameters

∥☆過路亽.° 提交于 2019-12-08 04:37:43

问题


We're using jQuery UI MultiSelect widget on our website for various fields. For consistency we use it even for non-multi selects. The example code we use is:

jQuery('#model').multiselect({
multiple    : false,
minWidth    : 'auto',
height      : 'auto',
header      : false,
selectedText: multiselect_set_label,
open        : multiselect_fit_widget,
close       : multiselect_free_keyboard,
create      : multiselect_fit_label,
beforeopen  : multiselect_bold_options
});

Its not completely same everywhere, so we can't have just one setup for all multiselects. (If it was same everywhere I'd make a single initialization and try anonymous functions)

IE8 throws up the error "'multiselect_set_label' is undefined" (or multiselect_fit_widget or some other function).

That function is defined as follows:

function multiselect_set_label(selected, total, elements)
    {
    /* lots of code here */ 
    }

I also tried changing it to this:

var multiselect_set_label = function(selected, total, elements)
    {
    /* lots of code here */ 
    }

But the problems persist (I did clear cache between attempts).

Throughout testing all other browsers work fine, and since IE8 accounts for only 1.8% of our visitors this is not a burning problem for us, so if there's no simple solution I'll just ignore it. But if this can be solved it would be nice because our site is currently not usable at all on IE8. (I am aware that the reason for low percentage of IE 8 visitors might be because of the problems but we also don't have any visitor complaints)

来源:https://stackoverflow.com/questions/18461685/javascript-functions-dont-work-in-ie8-when-passed-as-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!