[Solved] Using JFactory::getDocument in Joomla 3.0 with jQuery


Try using the following:

<?php
   $document = JFactory::getDocument();
    $js="
       (function($) {
           $(document).ready(function(){
              $("a").click(function(event){
                 alert("As you can see, the link no longer took you to jquery.com");
                 event.preventDefault();
              });
           });
        })(jQuery);";
   $document->addScriptDeclaration($js);
?>

Hope this helps

1

solved Using JFactory::getDocument in Joomla 3.0 with jQuery