problem with jquery in joomla backend
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>
';
?>
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
精彩评论