0

I have a piece of jQuery code (an accordion widget that rolls text out and back in to one of several headers when clicked) from someone else in a CEWP that doesn't want to run. I have multiple suspected issues.

First, I don't know how to tell if jQuery's document.ready() function is firing, or even how to tell if everything is loaded in a way that enables my script to run.

Secondly, the script I'm trying to use requires a version of jQuery that differs from one that my company puts in the master page of the site, of which I don't want to fiddle with. Is there a way to make sure my script runs only on the version I am trying to target, even though there are 2 versions loaded?

Thanks for any help

1 Answer 1

0

On the page with your CEWP. Open F12 tool -> Console. Run below script:

if (typeof jQuery != 'undefined') {  
    // jQuery is loaded => print the version
    alert(jQuery.fn.jquery);
}

You will get "undefined" if no Jquery is running. Otherwise, you will get the version number alert.

(ref: https://stackoverflow.com/questions/6973941/how-to-check-what-version-of-jquery-is-loaded/6973954)

2
  • Thank you for this! Commented Aug 6, 2021 at 1:53
  • Please mark it as answer if feasible Commented Aug 6, 2021 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.