By computerbarry on
Hi all
In my theme info file I've added scripts[] = js/script.js - This loads as I can see everything inside chrome developer inside sources.
Everything seems ok.
But for some reason the jQuery functions I have created don't seem to work?
Just wondering if there is a way I can test my jQuery or find out if these functions are firing?
Example, I have the below which does nothing when any page loads.
$(document).ready(function() {
alert('Loaded!');
});Cheers, Barry
Comments
=-=
https://www.drupal.org/node/756722 may aid
Thanks VM
Thanks VM
Slowly getting there.
I've now added the jQuery library, I have the jQuery update running though mustn't be working.
scripts[] = 'js/jquery-1.11.1.min.js'
scripts[] = 'js/script.js'
Inside script I now have:
The alert is now firing after I added scripts[] = 'js/jquery-1.11.1.min.js', but for some reason the 'div.field-type-text-with-summary' function does nothing.
It does work as I've been testing this in fiddle.
Thanks, Barry
The more you learn.... the more you learn there is more to learn.
=-=
keep in mind you don't have to set the version of jquery in .info if you are using a specific version site wide which can be set in the jquery update config screen.
Also of note, https://www.drupal.org/project/jqmulti may be worth looking at if you intend to utilize multiple versions of jquery within a single site.
Yes I was aware of the
Yes I was aware of the version for jquery, the maximum version is 1.8.
I've removed the other version now from .info, started to cause a few lagging problems as well.
Everything still seems to work after removing the additional jQuery file and clearing my cache.
Thanks for the link though not sure I'll be using or want to load multiple copies.
So, as things stand, the jQuery update is working, my page alert is working but my other function is not?
Any suggestions why this could be?
Thanks VM
Barry
The more you learn.... the more you learn there is more to learn.
=-=
IIRC -dev includes 1.9 through 1.11
unfortunately no.
IIRC ?
IIRC ?
The more you learn.... the more you learn there is more to learn.
=-=
IIRC = If I Recall Correctly
checked my test install and -dev includes up to and including 1.10
Cool, ha nice to know.
Cool, ha nice to know.
I have tested everything in fiddle using 1.8 so I know the version is not the problem.
I best keep everything updated anyhow thanks.
Barry
The more you learn.... the more you learn there is more to learn.
I've just realised VM after
I've just realised VM after checking in fiddle that the function doesn't work loaded in the head, which is what's happening with script.js from my .info file.
How, what's the best way to add the function to a specific page in the body or footer?
Thanks, Barry
The more you learn.... the more you learn there is more to learn.