V
V
VanilaSpirit2020-06-21 19:22:54
JavaScript
VanilaSpirit, 2020-06-21 19:22:54

How to connect jquery ui in ASP.NET Core?

At the office I found a piece of code on the site and connected my libs downloaded via nuget:
_layout file: (in head)

<script src="~/lib/jquery-ui/jquery-ui.js"></script>
    <script src="~/lib/jquery-ui/jquery-ui.min.js"></script>
    <script>
        $(function () {
            var availableTags = [
                "One",
               "Two",
                "Three"
            ];
            $( "#tags" ).autocomplete({
                source: availableTags
            });
        });
    </script>


But at startup, it only gives out $ is not defined.
How to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valera Karmanov, 2020-06-21
@motokraft

You also need to include jQuery

But at startup, it only gives out $ is not defined.

(function ($) { })(jQuery);

V
Vladimir Korotenko, 2020-06-21
@firedragon

What do you want? Copy-pasting old code is a bad idea. Asp-for tags is that a renderer? Is it in your controls?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question