Import jQuery Validation

philip_nunoo picture philip_nunoo · Aug 20, 2016 · Viewed 7.7k times · Source

I want to import 'jquery-validation' into an ES6 class

import $ from 'jquery'
import 'jquery-validation'

but when I do anywhere in the same file

$(...).validate({...})

I get the error

Uncaught TypeError: $(...).validate is not a function

Answer

Brad Adams picture Brad Adams · Mar 22, 2018

From the looks of your code example you weren't importing it correctly. Works 👌 for me with the following imports (with Webpack bundling):

import $ from 'jquery'
import validate from 'jquery-validation'