Why this error?: Uncaught TypeError: Cannot read property 'parents' of null

tekgrl
tekgrl used Ask the Experts™
on
Why am I getting the following JS error: Uncaught TypeError: Cannot read property 'parents' of null

Here is the code I'm using:

https://codepen.io/asna_farid/pen/fKChk
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
That Code Pen is not generating an error that I can see. What are the steps to reproduce?

Author

Commented:
Added javascript to external file.
Michael VasilevskySolutions Architect

Commented:
Make sure you have a reference to jQuery in your file if you're working outside of CodePen:

<script src="https://code.jquery.com/jquery-3.3.1.min.js" ></script>

Open in new window

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
I don't understand your response - where is the error?
Commented:
I fixed the error by replacing all instances of "$" with "jQuery". Thanks for the help, everybody.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
That is not necessary - all that was required it to change the $ for the document ready to jQuery and pass $ as a parameter.

jQuery(function($) {
 // Use $ as much as you want here
});

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial