JavaScript/jQuery - “$ is not defined- $function()” error

后端 未结 8 1980
轻奢々
轻奢々 2020-11-30 08:15

I am trying to run a JavaScript/jQuery function and Firebug gets the error:

$ is not defined $(function()\".

The JavaScript code is placed

相关标签:
8条回答
  • 2020-11-30 09:06

    Im using Asp.Net Core 2.2 with MVC and Razor cshtml My JQuery is referenced in a layout page I needed to add the following to my view.cshtml:

    @section Scripts {
    $script-here
    }
    
    0 讨论(0)
  • 2020-11-30 09:11

    I have solved it as follow.

    import $ from 'jquery';
    
    (function () {
        // ... code let script = $(..)
    })();
    
    0 讨论(0)
提交回复
热议问题