Jquery conflict validation above jQuery file?

I have tested WP and WP issues. When I put validation under jQuery it will be without an error but above jQuery it will be an error:

Uncaught ReferenceError: jQuery is not defined

Is it usually it should be put under jQuery?

If your validation script requires jQuery, then yes it must be put beneath. The proper way would be to enqueue the script though, and just specify jQuery as a dependency:

// In a theme:
wp_enqueue_script('validation', get_theme_file_uri('path/to/validation.js'), ['jquery']);
// Or in a plugin:
wp_enqueue_script('validation', plugin_dir_url(__FILE__) . 'path/to/validation.js', ['jquery']);

Thank you for the message. I will test.

It is working. Thank you.

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