dot thousand on load

by bvotcode

HTML

<input name="locationError" type="text" value="1221312321" readonly/>
<input name="locationError" type="text" value="9999999999" readonly/>
<input type="number"  value="100035800">

JavaScript

$("input").each(function(){
        var x = $(this).val();
       // alert(x);
        $(this).val(x.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ".")); 
    });