Im using this code to restrict the user to not enter special characters
$("input").keyup(function(){
var text=$(this).val();
$(this).val(text.replace(/[^\w\d\s]/,""));
})
I want to restrict the user to enter only one word without space and also having no numbers and special characters. like this
myword #valid
myword2 #invalid
myword secondword #invalid
Test it here »