0

I want to connect other .js file to my .vue file.
So, i use theese line of code in my .vue file:

import  jQuery from 'jquery'
import './assets/js/script'

But, the console in Chrome (and other browsers) say:

Uncaught ReferenceError: jQuery is not defined

I don't get why is it happening because i import jQuery var. and i use jQuery(). structure in my .js file

UPD: Sure, i have used npm install jquery;
I have also tried to use var jQuery = require("jquery")

1 Answer 1

1

Try

import $ from 'jquery'

As suggested in the comments.

There are multiple ways to implement jquery into your project. For other people who come across this question I will reference a few links you can try if the above suggestion does not work.

article 1

article 2

Sign up to request clarification or add additional context in comments.

2 Comments

please using import $ from 'jquery' change your import
Please add some explanation to your code such that others can learn from it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.