jQuery punto migliaia
by rombecchi
HTML
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<input type="text" class="number"/>
CSS
input {font-size:2em;}
JavaScript
$('input.number').on('keydown', function(event) {
if (event.which >= 37 && event.which <= 40) return;
}
$('input.number').on('keyup', function(event) {
// si controllano solo i numeri
if (event.which >= 37 && event.which <= 40) return;
// formattazione
$(this).val(function(index, value) {
return value
.replace(/\D/g, "")
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
});
});