2013-05-15 17 views
0

如何添加內聯jQuery的javascript到組件視圖在joomla 3中。如果我添加它像<script>my javascript mixed with <?php echo $myvariable ?></script>是造成空白頁和debuger什麼都沒有顯示。比我一直在試圖使用文檔中提供的例子,但我有標記與它的問題內聯jquery在joomlas 3視圖

<?php 
$document = JFactory::getDocument(); 
$document->addScriptDeclaration(' 
    window.event("domready", function() { 

    }); 
'); 
?> 

是什麼joomla3使用它的正確方法

回答

0

您使用它的權利,但多數民衆贊成沒有jQuery。試試這個:

$document = JFactory::getDocument(); 
$document->addScriptDeclaration(' 
    jQuery(document).ready(function() { 
     //do stuff 
    }); 
'); 
?>