setting input text from UI Slider
Hi there, I am trying to display the values from a slider as I change it. I can only get the text to init properly, but not update upon changing the value with the mouse. Could someone please suggest a solution?
Thanks.
- <!DOCTYPE html>
- <html>
- <head>
- <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
-
- <style type="text/css">
- #slider01 { margin: 10px; }
- #slider02 { margin: 10px; }
- </style>
-
- <script>
-
- $(document).ready( function() {
- s = $("#slider01").slider();
- s.slider('option', {min: 1, max: 40});
- s.slider('option', 'value', 2);
- $("#val01").val( s.slider('value') );
-
- });
- </script>
- </head>
- <body style="font-size:62.5%;">
- <div id="slider01"></div>
- <input type="text" id="val01"/>
-
- </body>
- </html>