aehlke / tag-it

A jQuery UI plugin to handle multi-tag fields as well as tag suggestions/autocomplete.
http://aehlke.github.com/tag-it/
MIT License
2.48k stars 825 forks source link

Does not work with MVC/CSHTML? #371

Open thirdvalve opened 8 years ago

thirdvalve commented 8 years ago

I'm having a problem integrating Tagit into an MVC project. I keep getting an error that the "object does not support the .tagit property." Not sure what I might be doing wrong...

I have references to the tagit.css and tagit.ui-zendesk.css in our _Layout.chstml, Also have references to the jquery JS files:

script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js" type="text/javascript" charset="utf-8">

///////////////////////////////////////////////////////

My javascript file which gets references from my .chstml file has this:

$(document).ready(function () {

$(function () {
    //-------------------------------
    // Allow tags with spaces and no quotes.
    //-------------------------------
    $('#searchTags').tagit({
        allowSpaces: true
    });

});

////////////////////

@{ Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; }

@section Scripts { <script src="@Url.Content("~/Scripts/adminsearch.js")"> }

    ///////////////////////

    What could be wrong here? Seems like the Tagit never kicks in?

    mbarmettler commented 7 years ago

    Hi thirdvalve,

    i know its a long time ago since. but i'm running into the same issue with the allowspaces - that i have set the option to true and i still cant enter spaces - it creates a new tag on hitting SPACE.

    how can i solve this? thanks