problem with jquery in joomla backend

て烟熏妆下的殇ゞ 提交于 2019-12-13 04:59:07

问题


pls somebody know where is problem ? want to use jquery in joomla backend, i read, that i must use jQuery.noConflict, cause of mootools in joomla, but with this code i get error:

jQuery is not defined

[Break on this error] jQuery.noConflict();

what is wrong ?? thanks

<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>
 ';


  ?>

回答1:


put this code on admin.controller.php or on controller.php of your component folder

$document =& JFactory::getDocument();
$rootURL = JURI::root();
$document->addScript($rootURL.'media/system/js/jquery.min.js' );
//$document->addScript('jQuery.noConflict();');
jimport('joomla.application.component.controller');

try this



来源:https://stackoverflow.com/questions/5003613/problem-with-jquery-in-joomla-backend

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