
This is actually very interesting. I had a text field which expected a single word string and I had to check it on client side. Using jQuery and JavaScript’s split function we can easily check if an input string contains spaces or not.
split function accepts a delimiter as first parameter, a string as second paramter and splits the string into an array by that delimiter. Returns original string if delimiter is not found.
Here is the code I used :
// id of the textbox is timeTaken
var strText...
Published on March 01, 2012 06:55