0

I know how to add or attache a jquery/javascript file on the specific page.

My problem is that I'm trying to add jQuery file (included in theme) at the end of every thing in the body tag so any other file or module would not override it but can't figure out yet.

Is there any way to do that?

Example:

enter image description here

  • If jQuery is last, no other script will be able to use it, and it would mkae no sense to include jQuery as a result, since it wouldn't be used. It is included above any scripts that require it. You should be leaving it as that. – Jaypan Jul 24 '18 at 23:45
  • Hi @jaypan, I think my question should have more details so anybody can understand, so check out drupal.stackexchange.com/questions/266318/… , this is why I like to do that because I thing geofield_google_map.js or geojson.js is restricting me to run click event. – usmanjutt84 Jul 25 '18 at 0:31
0

You need to set a dependancy on your library definition. e.g. if you want your custom.js after geofield then in the library you define custom.js you need to set a dependancy e.g.:

mylibrary:
version: VERSION
js:
  js/custom.js: {weight: 0}
dependencies:
  - geofield_gmap/geofield_gmap

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.