How to add javascript to Joomla 2.5 articles

Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life here.

When you’re writing an article in Joomla 2.5 and save the changes, there are various elements that Joomla will naturally remove from your content. For example, if you’ve added any javascript to your article, Joomla will remove your script tags. This is a security measure taken by Joomla, but when you really need to use javascript this does cause headaches for many users.

Just like javascript, Joomla removes iframes from code as well. In a previous article we showed you how to allow iframes in your html code, and allowing javascript code follows the same steps.

Question:How do I prevent Joomla from removing my javascript code?
Answer:Review our article on allowing iframes in your articles. Follow the steps in the article, but substitute <iframe> with <script>.

5 thoughts on “How to add javascript to Joomla 2.5 articles

  1. ReferenceError: jQuery is not defined. http ://edu.*********.in/ it is a diferent formate on a website approches all the interactive…

    1. Hello,

      We are happy to help, but it is not clear what your question is. Could you please provide additional information and links for us to test and replicate the problem.

      Thank you,
      John-Paul

  2. How to use jquery in joomla?

    when i type below code i got this error “ReferenceError: jQuery is not defined“.

    <script type=”text/javascript”>
         jQuery(.’btnLike’).click(function() {
             var abc = ‘Like’;
         });
    </script>

     

    Please let me know the solution of this error.

Was this article helpful? Join the conversation!