Jquery UI is used, js and css to be imported:
<link rel="stylesheet" href="../../themes/base/">
<link rel="stylesheet" href="../">
<script src="../../jquery-1.7."></script>
<script src="../../ui/"></script>
<script src="../../ui/"></script>
<script src="../../ui/"></script>
<script src="../../ui/"></script>
<script>
var emails=["","","","",""];
$( function () {
//Bind events for input box
$( "#email" ).keyup( function(){
emailiInp();
});
});
function emailiInp(){
var arrs= new Array()
inpVal=$( "#email" ).val();
//Create drop-down list dynamically based on the input value
$.each(emails, function (index,info){
if (("@" )==-1)
{
//No input @
arrs[index]=inpVal+ "@" +info;
} else {
//enter@
arrs[index]=(0,( "@" ))+"@" +info;
}
})
$( "#email" ).autocomplete({
//Bind the content of the drop-down list
source: arrs
});
}
</script>
Finally, let’s have a text box:
<input />