Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 20007 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > JavaScript > Appending comma after every fixed number in the length in text. ...
Puneet20884

Appending comma after every fixed number in the length in text.

 Code Snippet posted by: Puneet20884 | Posted on: 2/28/2010 | Category: JavaScript Codes | Views: 2122 | Status: [Member] | Alert Moderator   
Ads

Sometimes we need the automatic comma or semicolon insertion in the textbox say you get the multiple mobile numbers from user as input,
you want a comma after every 10 characters.
The code goes as :

function insert_comma()

{
var str=document.Form1.txtABA.value;
if(str.length%10==0 && str.length!=0)
document.Form1.txtABA.value=document.Form1.txtABA.value+",";
}


Best Regards,
Puneet Sharma - Infosys
Pune, India
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 9:25:17 PM