0
我调试一个Drupal模块,第二行drupal_add_js调用uc_discounts.js一个js函数呼叫是通过使用附加的Drupal JS的函数
drupal_add_js(drupal_get_path('module', 'uc_discounts') . '/uc_discounts.js');
drupal_add_js('(function($){jQuery(document).ready(function() { uc_discountsOnLoad(e); })})(jQuery);', array('type' => 'inline', 'group' => JS_DEFAULT, 'scope' => 'footer'));
存在萤火错误消息,的ReferenceError:uc_discountsOnLoad是没有定义,任何人都可以找出问题所在?
**更新**
我知道问题了!
的uc_discountsOnLoad如果定义外(函数($){})(jQuery的);可以调用〜但它不能使用jquery符号,这是冲突! 但在这种情况下,我该如何调用这个函数?
function uc_discountsOnLoad(e) {
context = $('body');
uc_discountsProcessCodes(context, e);
//Add click event listener to discounts pane button once
$("input[id*=uc-discounts-button]:not(.uc_discountsOnLoad-processed)",
context).addClass("uc_discountsOnLoad-processed").click(function(e) {
uc_discountsProcessCodes(context, e);
//Return false to prevent default actions and propogation
return false;
});
}
如果定义外uc_discountsOnLoad(E)(函数($){})(jQuery的);, $( '身体')会得到一个错误!
100%肯定函数存在,uc_discounts.js被加载〜 – hkguile 2013-03-13 01:23:52