Electron Jquery error #397

Closed
opened 2026-01-29 16:38:37 +00:00 by claunia · 2 comments
Owner

Originally created by @vardear1 on GitHub (Oct 25, 2019).

Developed an application with core 2.2 MVC and followed all the steps to use electron. After starting the application, the electron window opens with the splash page, however, I am receiving an error for jquery - Uncaught TypeError: Cannot read property 'fn' of undefined. Googled a lot for a solution without success. Any assistance to resolve this would be greatly appreciated. Thanks
Electron error

Originally created by @vardear1 on GitHub (Oct 25, 2019). Developed an application with core 2.2 MVC and followed all the steps to use electron. After starting the application, the electron window opens with the splash page, however, I am receiving an error for jquery - Uncaught TypeError: Cannot read property 'fn' of undefined. Googled a lot for a solution without success. Any assistance to resolve this would be greatly appreciated. Thanks ![Electron error](https://user-images.githubusercontent.com/57007803/67581400-f21ef600-f715-11e9-87bb-1a086cefbee3.JPG)
claunia added the bug label 2026-01-29 16:38:37 +00:00
Author
Owner

@Liam2349 commented on GitHub (Oct 26, 2019):

Are you trying to load jQuery yourself?

Electron already uses jQuery, so you have to load it a bit differently to use in your own scripts. I'm doing it like this:

<script src="~/js/jquery-3.4.1.min.js" onload="window.$ = window.jQuery = module.exports;" asp-append-version="true"></script>

You could copy this and replace the path to match your own project structure.

The asp-attribute is optional. You shouldn't need it for this file but I use it anyway.

@Liam2349 commented on GitHub (Oct 26, 2019): Are you trying to load jQuery yourself? Electron already uses jQuery, so you have to load it a bit differently to use in your own scripts. I'm doing it like this: <script src="~/js/jquery-3.4.1.min.js" onload="window.$ = window.jQuery = module.exports;" asp-append-version="true"></script> You could copy this and replace the path to match your own project structure. The asp-attribute is optional. You shouldn't need it for this file but I use it anyway.
Author
Owner

@vardear1 commented on GitHub (Oct 28, 2019):

Thanks so much Liam. Your solution worked like a charm

@vardear1 commented on GitHub (Oct 28, 2019): Thanks so much Liam. Your solution worked like a charm
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#397