Skip Navigation

[Resolved] Custom JS into View error

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user was getting the error "Uncaught TypeError: $ is not a function" in their custom jQuery function.

Solution:

Given the error that you are getting you will need to run the jquery script in compatibility mode. In this case just replace $ with jQuery.

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by davideE-4 3 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#2096667

Hi,
i inserted into view my custom js code but i see this error on consolle.

Uncaught TypeError: $ is not a function

The code is
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
$('select').selectpicker();
$('select.macro-categoria').on('change', function(){
console.log('TEST');
});
});

How can i fix?

Regards

#2097031

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for getting in touch.

Given the error that you are getting you will need to run the jquery script in compatibility mode. In this case just replace $ with jQuery.

This should resolve your issue.

Thanks,
Shane

#2097129

My issue is resolved now. Thank you!