Here i've some code for autocomplete in textbox with the sign of "@" and "$"
<script>
var users = [
{username: 'lodev09', fullname: 'Jovanni Lo'},
{username: 'foo', fullname: 'Foo User'},
{username: 'bar', fullname: 'Bar User'},
{username: 'twbs', fullname: 'Twitter Bootstrap'},
{username: 'john', fullname: 'John Doe'},
{username: 'jane', fullname: 'Jane Doe'},
];
var stocks = [
{username: 'BUMI', fullname: 'Bumi Prosperindo'},
{username: 'BMRI', fullname: 'Bank Mandiri'},
{username: 'BBRI', fullname: 'Bank BRI'},
{username: 'BBCA', fullname: 'Bank BCA'},
{username: 'DBSA', fullname: 'Bank DBS'},
{username: 'OPRS', fullname: 'Siloam Hospital'},
];
$('#example-1').keypress(function(event) {
if( event.which == 36 )
{
$('#example-1').suggest('$', {
data: stocks,
map: function(stock) {
return {
value: stock.username,
text: ''+stock.username+' <small>'+stock.fullname+'</small>'
}
},
filter: {
casesensitive: false,
limit: 8
}
})
}
else
{
$('#example-1').suggest('@', {
data: users,
map: function(user) {
return {
value: user.username,
text: ''+user.username+' <small>'+user.fullname+'</small>'
}
},
filter: {
casesensitive: false,
limit: 8
}
})
}
});
</script>
but i've found, this code that work only for the sign "@" not working with the Sign of "$".
what i want is the "@" and "$" is working together within the textbox.
example is :
"the @alpha is going to kill the @BUMI"
thanks.