I want to activate jQuery auto-complete in a text-box when user enters any particular character like @. means when user enters his email address like [email protected] in text-box after typing "john" when user enters "@" in text then auto-complete should be activated, and should display the list of mail extension ("Gmail.com," "Hotmail.com," "rediffmail.com," etc).
A:
It's hard to read out your exact question/problem, but maybe you are looking for something like this:
var mailProviders = {
'@gmail.com': 'Google Mail',
'@hotmail.com': 'Windows Live Mail',
'@blizzard.com': 'OMG GIEF GOLD!1'
};
$("#inputfield").change(function(){
provider = String($(this).val()).split('@');
if (provider.length == 2)
$("#infospan").html( mailProviders[provider[1]] );
else
$("#infospan").html( '' );
});
That will update the content of <span id="infospan"></span>
whenever the user has entered a known mail host from the list.
kb
2010-02-02 12:34:30
A:
This jQuery autocomplete plugin is pretty great.
I don’t think it has the exact functionality you’re looking for though (i.e. “when user enters his email address like [email protected] in text-box after typing "john" when user enters "@" in text then auto-complete should be activated”). You’ll need to customise it yourself for that.
Paul D. Waite
2010-02-02 13:04:00