For browser which support DOM3 event.key,
textbox.onkeyup = function(e) {
if(e.key === '@') alert('@ detected');
};
Demo
Since event.key is not widely supported, you should have a event.keyCode or event.which fallback.
The problem is that those only contain the number of the key which produced the character, not the character itself. And in my keyboard, @ doesn't have its own key, it must be produced with Ctrl+Shift+2 or Alt Gr+2.
Then, for keyboards like mine, you can use
textbox.onkeyup = function(e) {
if(e.key === '@'
||
e.altKey && e.ctrlKey && (e.keyCode||e.which)===50
)
alert('@ detected');
};
Demo