Input field value – remove leading zeros

More simplified solution is as below. Check this out!

var resultString = document.getElementById("theTextBoxInQuestion")
                           .value
                           .replace(/^[0]+/g,"");

Leave a Comment