1

i am using jquery ui autocomlete for one of my projects, it is working fine bt what i really want is as soon as i hit enter on one of the key suggestions another suggestion box should get displayed displaying some values, so after selecting that second value the whole key-value pair gets enters in the input text field

    var source1 = ['key1','key2',key3',....etc] ; 
var source2 = [ 'value1','value2','value3',....etc] ;             $('#firstInput').autocomplete
({ source: source1, 
select: function(event, ui) 
{ $('#firstInput').autocomplete({ source:source2}); 
} 
}); 

i applied the above code but dsn't work.........only autocomplete gets applied for the first time..:( –

3
  • Could you provide some of your code to complete your description? Commented Aug 2, 2015 at 12:09
  • Have you tried configuring select function? that may help Commented Aug 2, 2015 at 12:28
  • var source1 = ['key1','key2',key3',....etc] ; var source2 = [ 'value1','value2','value3',....etc] ; $('#firstInput').autocomplete({ source: source1, select: function(event, ui) { $('#firstInput').autocomplete({ source:source2}); } }); i applied the above code but dsn't work.........only autocomplete gets applied for the first time..:( Commented Aug 3, 2015 at 7:14

1 Answer 1

1

Try configure select function with auto-complete, for example below -

$('#firstInput').autocomplete({
source: [ 'value1', 'value2' ], 
select: function(event, ui) { 
   // this handler can be used to trigger other event.  
   console.log(ui.item.id);
}

});

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried the above solution but it doesn't work , if you have achieved what i am asking can u please show me the specific code you have written inside select event, thanks for answering

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.