V
V
Viktor Pavlov2021-07-03 21:52:28
Drupal
Viktor Pavlov, 2021-07-03 21:52:28

Why JS code doesn't work in drupal?

I'm completely new to programming so don't swear too much, but the question is simple, I tried to insert javascript code directly into the page.tpl.php (cms drupal7) template file. the script didn't work, then just decided to check by inserting a function, nothing happens. I understand that drupal has its own methods for inserting js files, but there are only a couple of lines of code. The question is, why doesn't it work and where could I screw up? I’m sure that everything is simple there, but I can’t understand what’s wrong, I repeat, I’m completely green in programming.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
antiden, 2021-07-06
@donda

js which vanilla or jquery? Are you connecting in the header or footer?

  • If jQuery then try the jquery_update module
  • If vanilla then look in the console

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question