DEV Community

Cover image for how to give number format to a input box text while I am typing it
Carlos Alberto
Carlos Alberto

Posted on

how to give number format to a input box text while I am typing it



<br>
function format_num(id) {<br>
var number = document.getElementById(&quot;principal&quot;).value;<br><br>
var checkedNew = number.split(&#39;.&#39;).join(&quot;&quot;);<br><br>
document.getElementById(&quot;principal&quot;).value = checkedNew.toString().replace(/\B(?=(\d{3})+(?!\d))/g, &quot;.&quot;);<br><br>
}<br>














Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more