Demo of Spinner : Setting value




HTML

<input id="spinner" class='selector' size=3>
<button id=b1 >Set to 100</button><button id=b2 >Set to 500</button>

JQuery

<script>
$(document).ready(function() {
$( "#spinner" ).spinner();
$('#b1').click(function(){
$( "#spinner" ).val(100) // set the value of spinner
})
////////
$('#b2').click(function(){
$( "#spinner" ).val(500) // set the value of spinner
})
////////
})
</script>

Full Code

<html>
<head>
<title></title>
</head>

<input id="spinner" class='selector' size=3><button id=b1 >Copy Value</button>
<div id=d1></div>

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<link href="https://code.jquery.com/ui/1.12.1/themes/blitzer/jquery-ui.css" rel="stylesheet">

<script>
$(document).ready(function() {
$( "#spinner" ).spinner();
$('#b1').click(function(){
var value = $( "#spinner" ).spinner( "value" );
$('#d1').html("Spinner value : " + value);
})
})
</script>

</body>
</html>