Friday, November 4, 2011

How add Javascript in Joomla article easily

Wondering to add Javascript snippet in Joomla article. Here is the easiest way to add.
Goto Joomla Administrator -> site -> Global Configuration.
Select Editor - TinyMCE 2.0 as Default WYSIWYG Editor & save it.
that's it you are now free to write javascript code in articles.
Don't try to change above setting otherwise you will lose Javascript code from joomla article. It worked for me with Joomla 1.5 version.

Somewhere i read following lines but it won't help me at all cause it adds extra tags like mce_href & it changed the code according to it's structure which is nonsense(but it just make sure that your JS code wont lose if you change above settings).
Go to plugin manager & click on tiny TinyMCE 2.0
Go to plugin parameters
select "never" to Code cleanup on save option & save it.

I suggest use this method only when there is no preference to use editor other than TinyMCE. Otherwise you need to find a plugin from joomla extensions.