Javascript in Static HTML blocks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2014 03:01 AM
Hello,
I wanted to insert some Javascript into a couple of our Static HTML content blocks but, on saving, the script is comments out with a CDATA tag.
Can someone please tell me whether this is intentional?
The Javascript is intended to simply add another paramater to the incoming URL.
I have read that we may be able to add the the "extended_valid_elements" setting within the TinyMCE settings but I wouldn't want to risk this.
If I can't place this in the content block can someone please tell me if there is another way of doing this?
Many thanks,
Keiron.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2014 03:03 AM
You can use Dynamic content block which supports HTML and javascript as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2014 03:45 AM
Many thanks for the quick reply Chandana.
I've now added the Javascript function to a test Dynamic Block and followed it by the HTML.
In the HTML one of the buttons' 'onClick' event targets the JS function but it I get this error (in Firefox):
ReferenceError: myTestFunction() is not defined
Do I need to place the function elsewhere for an onClick event to work?
Many thanks,
Keiron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2014 04:10 AM
you can write the javascript block in the same dynamic content, just use the below format inside the jelly code.
<script>
function myTestFunction(){
function definition...
}
</script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2014 04:13 AM
My apologies Chandana - I was too hasty with my reply.
I had a second curly bracket which it obviously didn't like.
Many thanks for your help - I will now mark it as correct,
regards,
Keiron.