How to trim string value :: JavaScript Tutorial

hi all..
hope everything is good at your end ..
today, there is a smal tip for javascript users …
umm infact 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 befor submitting to server side
here is the quick way to do this .
<script type=”text/javascript” language=”javascript”>
function trim(paramString){
return paramString.replace(/^\s*/, “”).replace(/\s*$/, “”);
and thats it …
happy development 🙂

free counters

Comments 12

  1. Hey theгe this iss kibd of of ᧐ff topic buut I was wondering if bloɡs use WYSIWYG editors or
    if you have to manuallʏ code with HTML. I’m starting a
    Ƅlig soon but have no coding knowleԀge so Ӏ wanted
    to get advice from someone with exρerience. Any hrlp wouⅼd be enormously appreciated!

  2. Great website you have here but I was curious if you knew of any
    forums that cover the same topics talked about here?
    I’d really love to be a part of online community where I can get opinions from
    other experienced people that share the same interest.
    If you have any suggestions, please let me know.

    Thanks a lot!

    Here is my blog Nitro Strive Review

  3. Good day! I know this is kinda off topic
    nevertheless I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa?
    My site discusses a lot of the same subjects as yours and I feel we could greatly benefit from each other.
    If you might be interested feel free to shoot me an email. I
    look forward to hearing from you! Great blog by the way!

    Here is my web-site: Astroscope

Leave a Reply

Your email address will not be published.