Scripts on some pages that use jquery are not activating.
Finding that I couldn't get a script to work I put a very simple test script on a page in order to test that the jquery was functioning.
This should add a red border but it will not function.
Troubleshooting I've Tried
I checked for the presence of the jquery core and it appears in the header of the page. Its enqueued and appears to be working correctly on some other pages, so I have no reason to suspect that its been corrupted.
I tried the following tests:
- Put the above script in the header template, just before the </header>
- Put the script in the body of the page right above the test paragraph to which it relates
- Enqueued the script in case there was some sort of conflict that I wasn't anticipating. This caused the page to stop loading - can't see why this would cause a problem..
- Finally since I'm a novice and I always suspect that I'm the cause of the problem I put the script and html snippet onto a page on my local MAMP server. It worked as expected. I think this exonerates my coding but maybe not.
I'm bemused as to what the cause of the problem might be.
I'd appreciate any suggestions as to where to look for the possible source of the problem.