I am trying to make a simple jQuery script work under Joomla 3. Here is what my module looks now:
<?php
// no direct access
defined('_JEXEC') or die;
$doc = JFactory::getDocument();
JHtml::_('jquery.framework');
$doc->addScriptDeclaration('
$(document).ready(function () {
$(".text").text("By this");
});
');
?>
<div class="text">Text should be changed...</div>
I tried this snippet on a normal page and works perfectly, just I don't know why it does not want to work in Joomla. I installed the jQuery Easy plugin as well, but with no success.
See Question&Answers more detail:os