problem with jquery in joomla backend

2019-09-03 13:39发布

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条回答
Fickle 薄情
2楼-- · 2019-09-03 14:06

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

查看更多
登录 后发表回答