简体   繁体   English

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

[英]jquery function working well in chrome, but throws error in firefox

please help me out with this error that i get in my Firefox. 请帮助我解决我在Firefox中遇到的这个错误。 the function is working well in chrome, i just wish it could work in the same way in Firefox too. 该函数在chrome中运行良好,我希望它也可以在Firefox中以相同的方式工作。 this is the script that seems to have the problem. 这是似乎有问题的脚本。

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 throws the following error. firebug抛出以下错误。

TypeError: jQuery(...).openmrsSearch is not a function TypeError:jQuery(...)。openmrsSearch不是一个函数

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

This indicates, there's a conflict in your jQuery or jQuery library not included, or may be there's no such function. 这表明,你的jQuery或jQuery库中没有包含冲突,或者可能没有这样的功能。 Try including jQuery library before your script, still occurs try including , 尝试在脚本之前包含jQuery库,仍然会发生尝试包括,

jQuery.noConflict();

before your script! 在你的脚本之前! Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM