Excuse the title I'm not sure how to describe what I'm doing
I have a textarea where people can write comments but they can also mention people using an @mention system I have made... now my only issue is once the user starts typing after the @ it doesnt narrow down the users so say I have an array of objects like so..
users = [
{
name: steve,
id: 47
},
{
name: james,
id: 41
},
{
name: guy,
id: 44
},
{
name: troy,
id: 32
}
]
how can I filter out users in the array depending on the string thats being written after an @ symbol so If I write @tr in my text area my users array should now look like this
users = [
{
name: troy,
id: 32
}
]
Any help would be appreciated!