In this post Asp.Net jQuery UI Slider Get Value we shall see how to
get the current position value from a slider control.
Add DIV tag to the page
and add the below jQuery script.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title> jQuery UI Slider</title>
<link type="text/css"
href="css/smoothness/jquery-ui-1.8.21.custom.css"
rel="Stylesheet" />
<script
type="text/javascript"
src="JavaScript/jquery-1.7.2.js"></script>
<script
type="text/javascript"
src="JavaScript/jquery-ui-1.8.21.custom.min.js"></script>
<link
type="text/css"
href="Stylesheet.css"
rel="Stylesheet" />
<script type="text/javascript">
$(function() {
// Get
Slider value
$("#divSliderGetValue").slider({
slide: function(event, ui) {
$('#txtSliderGetValue').val(ui.value);
}
});
$('#txtSliderGetValue').val($('#divSliderGetValue').slider('value'));
$('#txtSliderGetValue').val($('#divSliderGetValue').slider('value'));
});
</script>
</head>
<body>
<form id="frmSlider" runat="server">
<table>
<tr>
<td>Slider GetValue</td>
<td><asp:TextBox
id="txtSliderGetValue"
runat="server"></asp:TextBox>
</td>
<td>
<div id="divSliderGetValue"
style="width:100px;"></div>
</td>
</tr>
</table>
</form>
</body>
</html>
For a full
example covering all possible scenarios in using a jQuery UI Slider control
refer to the post Asp.net jQuery UI Slider Tutorial
Related Posts
Asp.net jQuery UI Slider with two handles
1 comment:
Can I ask what is the purpose of the 2nd .val assignment?
Post a Comment