未定义jQuery
[打破此错误] jQuery.noConflict();
有什么不对?感谢
<div id="stlac">STLAC</div>
<?php
$document = &JFactory::getDocument();
$document->addScript(JPATH_SITE.'/media/system/js/jquery-1.2.6.min');
$document->addScriptDeclaration ('jQuery.noConflict();');
echo '<script type="text/javascript">
$("#stlac").hide();
</script>
';
?>
答案 0 :(得分:1)
将此代码放在组件文件夹的admin.controller.php
或controller.php
$document =& JFactory::getDocument();
$rootURL = JURI::root();
$document->addScript($rootURL.'media/system/js/jquery.min.js' );
//$document->addScript('jQuery.noConflict();');
jimport('joomla.application.component.controller');
试试这个