jQuery UI Spinner

HTML

<input type="text" id="spinner" value="0">

CSS

.ui-spinner-input{
  margin-right: 0;
}

JavaScript

function resizeInput() {
		if($(this).val().length > 0){
    	$(this).attr('size', $(this).val().length);
    }
    else{
    	$(this).attr('size', 1);
    }
}

var intputElem = $('input[type="text"]');

intputElem
    // event handler
    .keyup(resizeInput)
    // resize on page load
    .each(resizeInput);

$.widget( "ui.pcntspinner", $.ui.spinner, {
    _format: function( value ) { intputElem.each(resizeInput); return value; },
    
    _parse: function(value) { return parseFloat(value); }
});

$("#spinner").pcntspinner({ 
    min: 10,
    max: 100000,
    step: 100 });