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

Puneet20884
Posted by Puneet20884 under JavaScript category on | Views : 3342
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+",";
}

Comments or Responses

Login to post response