Insert the scrollbar value into input field

Insert the scrollbar value into input field

Hi
I've this script, inspired by the codrops slider pagination concept http://tympanus.net/codrops/2012/12/21/slider-pagination-concept/
I'd like to put the value obtained by the slider into an input field value (i.e. <input type="text" value="((slider value here !))"> ) instead of into the div#preview.
How can I do ?
Thanks

KD










  1.         <div class="container">   
                    <div id="preview" type="text" class="preview">0</div>

                    <div id="slider" class="sp-slider-wrapper">
                    </div>

            </div><!-- /container -->





  2. <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
            <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
            <script src="js/jquery.ui.touch-punch.min.js"></script>
            <script src="js/jquery.pagination.js"></script>
            <script>
                $(function() {
                    var $update = $( '#preview' );
                    $( "#slider" ).pagination( {
                        total : 12,
                        onChange : function( value ) {
                            $update.text( value );
                        }
                    } );
                });
            </script>