Use a change function to map non-integer inputs to a suitable default value, e.g
var myspinner = $( "#myspinner" ).spinner(
{
min: 1,
change: function (event, ui ) {
var val = myspinner.spinner( "value" );
myspinner.spinner("value", parseInt(val,10) || 1);
/*
var val = $(this).spinner( "value" );
$(this).spinner("value", parseInt(val,10) || 1);
*/
}
});
This won't prevent the user from typing nonsense, but it will constrain the values in the spinner as soon as the spinner loses focus. If you absolutely must block typing of anything but numbers, you might be able to do something with the keypress() function. See jquery to check when a someone starts typing in to a field for more details.