Whilst small files can be uploaded to forum posts, if you have a custom theme or module to contribute please add it on the "Add-ons" page.
  • Page:
  • 1

TOPIC:

Create HTML bloc containing javascript 1 month 1 week ago #1

  • avdl
  • avdl's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 174
i'm looking forward to build a specific HTML bloc (test website, not "production") and i'd need to put javascript in it.

I put part on body code in <script></script> (Control Panel / CSS and JS) and couldn't find a way to put the other part in bloc ( via source).
Is that possible ? perhaps things are disable by default for security purposes ?
thanks
andre

Please Log in or Create an account to join the conversation.

Create HTML bloc containing javascript 1 month 1 week ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
> perhaps things are disable by default for security purposes ?

Correct. Javascript can be used for good and bad...

You can add JS using the CSS+JS module.

it will be added to every page, and it can select the block using its ID.

document.getElementById('block-1234)...

If the JS is small, then it is no problem.

If the JS is very large, then you can write a small JS to detect element block-1234 and then load another file containing the full JS.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum