Search ebooks:

Wednesday, August 20, 2008

Find and Replace Regular expression in Javascript :

var trimreg = /(?:^\s+|\s+$)/; // To remove leading and trailing spaces

docs.sname.value = docs.sname.value.replace(trimreg,''); //sname is the html tag name of one text field

docs.mobile.value = docs.mobile.value.replace(trimreg,''); //mobile is the html tag name of one text field

No comments: