Basic JS insertion successfully done

This commit is contained in:
Christian Wolf 2019-06-11 14:11:46 +02:00
parent e3008b8789
commit 9cef15b4f5
4 changed files with 18 additions and 1 deletions

8
src/admin/res/clubs.js Normal file
View File

@ -0,0 +1,8 @@
jQuery(function($){
$('#mya').click(function()
{
//alert("a");
console.log("a");
});
});

View File

@ -20,3 +20,5 @@ Place: <?php echo $place->getName(); ?><br>
<h1>Output</h1> <h1>Output</h1>
<pre><?php print_r($this->log); ?></pre> <pre><?php print_r($this->log); ?></pre>
<a href='#' id='mya'>Test Link</a>

View File

@ -4,3 +4,5 @@
defined('_JEXEC') or die; defined('_JEXEC') or die;
// Append &layout=foo to URL // Append &layout=foo to URL
?>
<p>This is foo.</p>

View File

@ -2,6 +2,7 @@
use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
// No direct access. // No direct access.
defined('_JEXEC') or die; defined('_JEXEC') or die;
@ -44,6 +45,10 @@ class ClubsViewTest extends HtmlView
$this->log = $np; $this->log = $np;
parent::display($tpl); parent::display($tpl);
//Factory::getDocument()->addScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" );
JHtmlJquery::framework();
Factory::getDocument()->addScript('components/com_clubs/res/clubs.js');
//jexit();
} }
protected function getViewName() protected function getViewName()