Results 1 to 5 of 5

Thread: Javascript won't function

  1. #1
    User
    Join Date
    05-05-12.
    Posts
    49

    Default Javascript won't function

    I created a contact form within another application that allows me to copy and paste the javascript code into my website. With Contao, I chose 'code' as my new article and pasted the javascript into it. Unfortunately, all I keep getting back is text. Attached is a screenshot of what keeps happening. Can someone help ?
    Attached Images Attached Images

  2. #2
    Community-Moderator xchs's Avatar
    Join Date
    06-20-09.
    Posts
    1,292

    Default

    "Code" is the wrong content element to include JavaScript code, since it only adds a formatted code (with syntax highlighting) to the article (see the Contao manual: https://docs.contao.org/manual/en/ar...elements/#code )

    Instead you could try the "HTML" content element: https://docs.contao.org/manual/en/ar...elements/#html
    Contao Community Moderator
    → Support options

  3. #3
    User
    Join Date
    05-05-12.
    Posts
    49

    Default

    Thank you ! I'll try it and will let you know how it works.

  4. #4
    User
    Join Date
    05-05-12.
    Posts
    49

    Default

    I tried it but it didn't work.

  5. #5
    Community-Moderator xchs's Avatar
    Join Date
    06-20-09.
    Posts
    1,292

    Default

    Did you add the <script> tag to the list of allowed HTML elements?

    You can also do it as follows:
    • Create a file honeybook.html5 in the Contao's templates/ folder and add the code into this file
    • Include the file in the article / content element with the insert tag {{file::honeybook.html5}}
    Contao Community Moderator
    → Support options

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •