Follow by Email

Friday, 9 November 2012

Remove unwanted spaces in textbox using javascript

Step 1

Add the following code to your head:
<script language="javascript" type="text/javascript">
function removeSpaces(string) {
 return string.split(' ').join('');

Step 2

Use the following code for your text field:
<input type="text" onblur="this.value=removeSpaces(this.value);">
<input type="button" value="Click">


Post a Comment

Design by Abhinav Ranjan Sinha