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('');
}
</script>

Step 2

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

0 comments:

Post a Comment


                                                            
 
Design by Abhinav Ranjan Sinha