jquery 函数在 chrome 中运行良好,但在 firefox 中抛出错误

jquery function working well in chrome, but throws error in firefox

请帮助我解决我在 Firefox 中遇到的这个错误。该功能在 chrome 中运行良好,我只是希望它也能在 Firefox 中以相同的方式运行。这是似乎有问题的脚本。

function OpenmrsSearch(div, showIncludeVoided, searchHandler, selectionHandler, fieldsAndHeaders, opts) {
var el;
if(typeof div == 'string') {
    el = jQuery("#" + div);
}

if(!opts) {
    opts = {};
}

if(!opts.showIncludeVoided) 
    opts.showIncludeVoided = showIncludeVoided;
if(!opts.selectionHandler) 
    opts.selectionHandler = selectionHandler;
if(!opts.searchHandler)
    opts.searchHandler = searchHandler;
if(!opts.fieldsAndHeaders)
    opts.fieldsAndHeaders = fieldsAndHeaders;

jQuery(el).openmrsSearch(opts);
}

firebug 抛出以下错误。

TypeError: jQuery(...).openmrsSearch is not a function

jQuery(el).openmrsSearch(opts);
TypeError: jQuery(...)

这表明,您的jQuery或jQuery库中没有包含冲突,或者可能没有这样的功能。 尝试在脚本之前包含 jQuery 库, 仍然出现尝试包括 ,

jQuery.noConflict();

在你的剧本之前!希望对你有帮助。