如何在joomla 3中向组件视图添加内联jquery javascript。如果我像<script>my javascript mixed with <?php echo $myvariable ?></script>
那样添加它会导致空白页并且debuger什么也没显示。比我一直试图在文档中使用提供的示例但我有标记问题
<?php
$document = JFactory::getDocument();
$document->addScriptDeclaration('
window.event("domready", function() {
});
');
?>
在joomla3中使用它的正确方法是什么
答案 0 :(得分:0)
你正在使用它,但那不是jQuery。试试这个:
$document = JFactory::getDocument();
$document->addScriptDeclaration('
jQuery(document).ready(function() {
//do stuff
});
');
?>