This jQuery plugin makes an input field only contain alpha characters.
jQuery.fn.dnkl_onlyAlpha = function() {
/*
NAME: dnkl_onlyAlpha()
VERS: 1.0
DESC: Removes non-alpha characters from value
USAGE: $('#myInputID').dnkl_onlyAlpha();
*/
return $(this).each(function() {
$(this).keyup(function() {
var reg = new RegExp('[^A-z]');
if ($(this).val().match(reg)) {
$(this).val($(this).val().replace(/[^\-A-z]/g, ''));
}
});
});
}