Thursday, August 23, 2007

Remove Space At Beginning Of The String Using Regular Expression (Left Trim)

<script language="javascript">
function Right_Trim()
var str = document.getElementById('txt1').value;
str = str.replace(/^\s+/g,'');
document.getElementById('txt1').value = str;
<input type='text' id='txt1' value='                 Click To Check' />
<input type='button' id='bt1' value='Remove Space At Beginning Of The String' onclick='Right_Trim();' />

No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.