Uncaught TypeError: $ is not a function Error?

I’m trying to use some custom jquery in my Footer and I’m getting the following error. Can you help me figure out what’s wrong?

Uncaught TypeError: $ is not a function Error

Here’s the jquery that I put in the JS tab in my Footer:

if( $(“form”).hasClass( “qsm-quiz-form” ) )
{
$( “.e42635-1” ).addClass( “text” );
}

Hi Eli,

Thanks for writing to us.

Use jQuery instead of $. The code should be

if( jQuery(“form”).hasClass( “qsm-quiz-form” ) )
{
jQuery( “.e42635-1” ).addClass( “text” );
}

Please note that the code provided above serves as a guide only and is to help you in getting started so implementing it and maintaining the code will be out of our support scope and for further maintenance for new possible versions of the theme that may cause the customization to break, you will need to hire a developer.

Hope it helps.
Thanks

Thanks so much for the help. I’m now getting an error that says:

Uncaught SyntaxError: Invalid or unexpected token

Do you know how I can resolve that?

Hi Eli,

To solve this issue change the double quotes (" ") using keyboards. The code should be

if( jQuery("form").hasClass( "qsm-quiz-form" ) )
{
jQuery( ".e42635-1" ).addClass( "text" );
}

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.