ahmedkl Posted June 13, 2010 Share Posted June 13, 2010 I want to check if that an input field doesn't have any spaces in it for example input :text abc is invalid textabc valid. so can anyone help me on how to do this Link to comment https://forums.phpfreaks.com/topic/204660-space-validation-help/ Share on other sites More sharing options...
Alex Posted June 13, 2010 Share Posted June 13, 2010 Use indexOf: if(input.value.indexOf(' ') != -1) { // Contains a space } Link to comment https://forums.phpfreaks.com/topic/204660-space-validation-help/#findComment-1071515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.