We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ejautocomplete and keypress

Hi,
I'm using a ejAutocomplete and i need to call a function to perform a search when the user press ENTER (staying on the field). I found in the documentation that this control doesn't have an event for that, Am I right?
I can use something like this:
.keypress(function(event) {
        callMyFunction();
});
            
but the problem is that the user can press ENTER when is selecting an option from the list producing an undesirable effect.
Is there a solution to this problem? maybe some way to check if the user is or not selecting an item from the list in the keypress or something like that?

Thanks!       

3 Replies

KV Karthikeyan Viswanathan Syncfusion Team October 21, 2016 07:08 AM UTC

Hi Ignacio,  
  
Thanks for contacting Syncfusion Support.  
  
Query: “way to check if the user is or not selecting an item from the list”  
  
Yes, you can check the active item in the list using the getActiveText() method.  
  
  
JS Playground sample link: http://jsplayground.syncfusion.com/0eicxmmr     
  
  
Regards,  
Karthikeyan V.  



IG Ignacio October 21, 2016 03:19 PM UTC

Great, thanks!!


KV Karthikeyan Viswanathan Syncfusion Team October 24, 2016 08:56 AM UTC

Hi Ignacio, 
Thanks for the update. 
We are glad the suggestion helped you to achieve your requirement. 
Please let us know if you need further assistance. 
Regards,  
Karthikeyan V.

Loader.
Live Chat Icon For mobile
Up arrow icon