Below is my javascript code which allows only alphabets while entering if we enter numbers and some special characters it does not accept them while entering only this works fin
The reason your code wont accept numbers is because numbers have their own character code as well. The character code for 1, for example, is 48. To include numbers, you should include this in your if statement:
(charCode >= 48 && charcode <= 57)
Not sure why spaces aren't working, but see if the above helps!