Tim Richardson

Melbourne, Australia

  • Increase font size
  • Default font size
  • Decrease font size

How to insert javascript into Joomla 1.5 with JCE

E-mail Print PDF

 

Inserting javascript into Joomla articles

Currently using Joomla 1.5.20 with the latest JCE.

To embed Javascript in Joomla, you need to configure your editor. For JCE, you will need to have have the JCE Administration component installed, not just the JCE editor plug-in.

 

Under Components, you'll see JCE Configuration. If you don't see this, visit http://www.joomlacontenteditor.net/ and install the latest JCE plug-in and Administration Component.

The setting to allow Javascript to be embedded in an "Edit Code" action is found in the the Groups tab of the JCE Administration component.

Note that some editors have "code cleanup" which can strip javascript. So lock down who can change editors (or disable editors you are not using).

I didn't touch the default settings, so I have only one group that matters, called Default. Click it to edit it. Now you want to go to Editor Parameters, and in the second group of options you'll see Allow Javascript, which defaults to No. Change it to yes, and you'll be able to embed javascript via the "Edit Code" button. You may also want to enable PHP and CSS. I'm experimenting with this on a one-user site, so security is not a big deal. On a multi-user site,  I would set up a administrator group for JCE, and only allow this feature for administrators.

For a more comprehensive example, see this example, which includes using a javascript library to do form validation.

Tags:

Add this to your website
Last Updated on Friday, 17 September 2010 07:11  

Get site updates with Twitter