Hi all..
Hope everything is good at your end.
Today, there is a small tip for JavaScript users...
Umm, in fact, not a tip but a utility function to trim string values...
I was working on a project I had a need to trim user input before submitting to server side
Here is the quick way to do this .
[code language="javascript"]
<script type="text/javascript" language="javascript">
function trim(paramString){
return paramString.replace(/^\s*/, "").replace(/\s*$/, "");
}
</script>
[/code]
And that's it...
happy development :)
Comments
No comments yet — be the first to share your thoughts.
Leave a Reply