Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How do I use Javascript in HTML source editor

Go to End

2 Posts   895 Views


Community Member, 1 Post

15 June 2013 at 6:28am

I am a total newbie and I've been trying to build a website for a friend as a favour.
I'm trying to insert some Javascript into the HTML source editor in the CMS but I click insert and nothing happens and the code seems to be stripped out.

I understand that tiny MCE might be stripping out the code? Any silverstripe experts out there know how I can just write and edit code like normal into the HTML editor? Some sort of setting I have to change or list of allowed elements to put into the config files or something.

I'm really at a loss here. Please help me.

Nobrainer Web

Community Member, 138 Posts

15 June 2013 at 6:34am

I think you might be better of just placing the Javascript in the template file, or if you need to be able to add for each page via the CMS, add a normal textfield, instead of the HTMLEditorField.

See for info on how to add custom fields to the CMS.

Hope it helps :o)