Click here to Skip to main content
15,889,528 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to provide autocmplete Suggestion on entering of space bar..like tags in same code project but doesnot show in mine...how can i achive this...
my code is
$("#TagsTextBox").autocomplete({
             multiple: true,
             multipleSeparator: " ",
            source: function (request, response) {
            
                var nt = $("#TagsTextBox").val();
            
               
                $.ajax({
                    url: "../Document/TagSuggestion", dataType: "json",
                    data: { text: nt },
                   
                    success: function (data) {
                  
                        var obj = jQuery.parseJSON(data);

                       
                        response($.map(obj, function (item) {
                            return { label: item, value: item, id: item }

                        }))
                    }
                })
            },
            select: function (event, ui) {
            //Call Selecttit function
                var passdata=ui.item.id;
                AddTagToDiv(ui.item.id);
            }
        }); //auto comple for tag
Posted
Updated 3-Jan-12 23:40pm
v2

1 solution

to bind this event to the text box in question,
$(document).ready(function() {

  //your code above here.....

  $("#TagsTextBox").keyup(function(event){
     if(event.keyCode == 32)
     {
         $("#TagsTextBox").autocomplete('search', $("#TagsTextBox").val());
     }
  });
});



hopefully that at least puts you on the right track.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900