how to use js codes in joomla articles?

Category: Joomla 25

caroleriva
Asked:
2013-03-24 11:26 pm EST

Hits: 742
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.
regards,

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

You must login before you can submit an answer.

OTHER ANSWERS

0

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

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

If you followed the steps in our how to add an iframe to a Joomla 2.5 article, you should have removed the word script from the Prohibited Elements section. You might also need to make sure your Super Users are set to have no filtering by going to Site > Global Configuration > Text Filters 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:


<script type="text/javascript">
alert("Hello world!");
</script>



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


<script type="text/javascript">// <![CDATA
alert("Hello world!");
// ]]></script>



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 :))
caroleriva
8 Points
2013-03-27 12:39 am EST
Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a 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!

Need more Help?

Search

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: support@InMotionHosting.com
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!