InMotion Hosting Support Center

how to use js codes in joomla articles?

Category: Joomla 25

2013-03-24 11:26 pm EST

Hits: 1,330
I followed the steps you described in order to let iframe be shown and it worked and then applied the same steps on the script tag but still i cannot see the js code result on my page. can you plz tell what else i should do?

thank you.

You must login before you can ask a follow up question.

You must login before you can submit an answer.



9,968 Points
2013-03-25 1:23 pm EST
Hello caroleriva, and thank you for your question.

When you click on the <strong>HTML source</strong> button in the TinyMCE editor in Joomla, are you still seeing your <strong>&lt;script&gt;</strong> tags there, or have they been stripped out?

If you followed the steps in our <a href="" target="_blank">how to add an iframe to a Joomla 2.5 article</a>, you should have removed the word <strong>script</strong> from the <strong>Prohibited Elements</strong> section. You might also need to make sure your Super Users are set to have no filtering by going to <strong>Site > Global Configuration > Text Filters</strong> in the admin panel.

If you're still having issues getting it working, it could be the JavaScript code itself and how it's coded. I would recommend trying to insert this test JavaScript and making sure it's not getting stripped out when you save the article:

<p class="code_block" style="width: 500px;">
&lt;script type="text/javascript"&gt;
alert("Hello world!");

It looks like Joomla automatically updates it to this after being saved:

<p class="code_block" style="width: 500px;">
&lt;script type="text/javascript"&gt;<strong style="color:red;">// &lt;![CDATA</strong>
alert("Hello world!");
<strong style="color:red;">// ]]&gt;</strong>&lt;/script&gt;

However when viewing the page, the JavaScript code is run right away and I get the pop-up message in my browser. If it's still not working for you please let us know.

- Jacob

You must login before you can post a comment about this answer.

Hello Jacob,

Thank you for the reply, i can't see the pop-up message in my browser after adding the code you said, however my js code is now working without making any changes.. looks strange, but it works :))
8 Points
2013-03-27 12:39 am EST
Like this Question?

Joomla Community Google+ Hangout #3

June 3rd, 2014

Thank you @RustyJoomla for letting me speak on the Joomla Community Google+ Hangout!

Click here to watch!

Support Center Login

Social Media Login

Social Login Joomla

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!