最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Import jQuery Validation - Stack Overflow

programmeradmin4浏览0评论

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

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
Share Improve this question edited Aug 20, 2016 at 1:22 Michał Perłakowski 92.6k30 gold badges163 silver badges186 bronze badges asked Aug 20, 2016 at 1:20 philip_nunoophilip_nunoo 9384 gold badges10 silver badges22 bronze badges 1
  • What method did you use to make your import statement available on the browser? I have a gulp browserify task with babelify transform that works just fine ( I have the same import statements you wrote above). Check these references: github./babel/babelify, egorsmirnov.me/2015/05/25/browserify-babelify-and-es6.html – Gabriel Ferraz Commented Dec 13, 2016 at 15:13
Add a ment  | 

2 Answers 2

Reset to default 13

From the looks of your code example you weren't importing it correctly. Works

发布评论

评论列表(0)

  1. 暂无评论