Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third Party JavaScript Libraries Not Working in ASP.NET Core MVC Project #20

Closed
sebetci opened this issue Nov 16, 2021 · 0 comments
Closed

Comments

@sebetci
Copy link

sebetci commented Nov 16, 2021

Hi @sadikturan,

Third party javascript libraries (jquery-validation, jquery-validation-unobtrusive, ckeditor) added to the project (Client-Side Validation and HTML Editor) aren't working. According to the results of the research, the <environment> tag is used in ASP.NET Core to include third-party scripts in the project. Therefore, I deleted the third party libraries defined as a @section Scripts and added the following usage to the _Layout.cshtml file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="~/modules/bootstrap/dist/css/bootstrap.min.css" crossorigin="anonymous">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
    <link rel="stylesheet" href="~/css/style.css">

    <!-- Added the following lines of code to the _Layout.cshtml file. -->
    <environment include="Development">
      <script src="/modules/jquery-validation/dist/jquery.validate.min.js" crossorigin></script>
      <script src="/modules/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js" crossorigin></script>
      <script src="/modules/ckeditor/ckeditor.js" crossorigin></script>
    </environment>

    <title>Shop Application</title>
</head>
<body>
   <!-- Other Lines of Code -->
</body>
</html>

Have a nice day.

Resources

@sebetci sebetci closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant