Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:19:14+00:00 2026-06-13T15:19:14+00:00

i am using jquery ui autocomplete in my tag textbox , its working fine

  • 0

i am using jquery ui autocomplete in my tag textbox , its working fine but the problem is that it gives suggestion only one time , for example first time when i enter a character it shows suggestion i select something from suggestion and it append that in text box with a comma but when i again enter a character it doesn’t show anything

my code is following

JQUERY

 function split(val) {
        return val.split(/,\s*/);
    }
    function extractLast(term) {
        return split(term).pop();
    }

    $("#tagsss")
    // don't navigate away from the field on tab when selecting an item
        .bind("keydown", function (event) {
            if (event.keyCode === $.ui.keyCode.TAB &&
                    $(this).data("autocomplete").menu.active) {
                event.preventDefault();
            }
        })
        .autocomplete({
            minLength: 0,
            source: function (request, response) {
                $.ajax({
                    url: "/Home/LookUpTag",
                    dataType: "json",
                    data: "searchterm=" + request.term,
                    success: function (data) {
                        response($.map(data, function (item) {
                            //  alert(data.length);
                            return {
                                label: item.Name,
                                value: item.Name,
                                Name: item.Name
                            };
                        }));
                    }
                });
            },
            focus: function () {
                // prevent value inserted on focus
                return false;
            },
            select: function (event, ui) {
                var terms = split(this.value);
                // remove the current input
                terms.pop();
                // add the selected item
                terms.push(ui.item.value);
                // add placeholder to get the comma-and-space at the end
                terms.push("");
                this.value = terms.join(",");
                return false;
            }
        });

My function in controller

Controller

public JsonResult LookUpTag(string searchterm)
    {

        var tags = context.tagService.Query().Where(x => x.name.Contains(searchterm)).Select(x => x.name).ToList();
        var list = tags.Select(item => new SearchJsonModel
        {
            Name = item,
            Value = item
        }).Select(model => (model)).ToList();
        return Json(list, JsonRequestBehavior.AllowGet);
    }

i worked alot on it but not found any error , Please tell me whats wrong in this code . Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:19:16+00:00Added an answer on June 13, 2026 at 3:19 pm

    Not sure but have you missed to call your extractLast() to retrieve the last term in the input?

    The source param

    source: function (request, response) {
                    $.ajax({
                        url: "/echo/json/",
                        dataType: "json",
                        data: "searchterm=" + extractLast(request.term),
                        success: function (data) {
                            response($.map(data, function (item) {
                                //  alert(data.length);
                                return {
                                    label: item.Name,
                                    value: item.Name,
                                    Name: item.Name
                                };
                            }));
                        }
                    });
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Jquery Autocomplete . Its workng fine but I have small problem.
I am using jQuery autocomplete which is working fine with existing element but not
I am using jquery autocomplete combobox , and its all working great. Visit http://jqueryui.com/demos/autocomplete/#combobox
I am using jQuery autocomplete and would like to limit the showing results only
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I am using jquery-rails-autocomplete and want to have autocomplete on more than one column.
im following the railscasts using jquery tokeninput http://railscasts.com/episodes/258-token-fields-revised in creating autocomplete tag tokens and
I'm implementing a Google Suggest like autocomplete feature for tag searching using jQuery's autocomplete.
I am using jQuery Autocomplete plugin 1.1 by Joern Zaefferer. Everything works fine on
I'm using jquery UI AutoComplete to allow users to tag friends using @mentions. By

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.