TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
R.D Ip
NA
76
8.3k
issue with bundleconfig file
May 7 2021 4:38 AM
I add a jquery path in bundle config.cs but give an below error
Create:52 Uncaught ReferenceError: $ is not defined
at Create:52
BundleConfig.cs
public
class
BundleConfig
public
static
void
RegisterBundles(BundleCollection bundles)
{
//here i add a jquery path
bundles.Add(
new
ScriptBundle(
"~/Scripts"
).Include(
"~/Scripts/jquery-3.4.1.min.js"
,
"~/Scripts/jquery.validate.min"
));
when I create a new project in mvc
then Bydefault jquery add in project see below
Create.cshtml
<h2>Create</h2>
<div>
<div>
Name : @Html.EditorFor(x => x.name)
</div>
</div>
@*<script src=
"~/Scripts/jquery-3.4.1.min.js"
></script>*@
<script type=
"text/javascript"
>
$(document).ready(function () {
//debugger
if i uncomment this below code
Create.cshtml
<script src=
"~/Scripts/jquery-3.4.1.min.js"
></script>
and comment the below code
BundleConfig.cs
////here i add a jquery path
//bundles.Add(new ScriptBundle("~/Scripts").Include(
// "~/Scripts/jquery-3.4.1.min.js",
// "~/Scripts/jquery.validate.min"
// ));
then working fine
but I am trying to add jquery in bundle file then give an error
why I am using bundle.config file because when project run then load the jquery library only at once
that is the reason I am adding bundle.config inside jquery path
If I use script add individually in view page then request load time increase
<script src=
"~/Scripts/jquery-3.4.1.min.js"
></script>
that is reason I am using bundle.config file
Reply
Answers (
1
)
Error When Uploading File: @using Html.BeginForm
asp.net core jquery to re-enable ddl ignore ddl source