PDA

View Full Version : Jquery slider interacting with textbox



abhijeet_1980
05-14-2010, 06:59 AM
I am developing a vertical jquery slider. I am able to fetch the value of slider in a text box.
I want to move the slider by typing in the values into the text box. any suggestion. Below is my code


<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.min.js"></script>
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>

</head>
<body style="margin:300px;">
<form name="tvfinder-pricerange">
<input type="text" id="amount" /> - <input type="text" id="amount1" />
</form>
<br><br />
<div id="slider-range" style="height:250px;" ></div>

</body>
</html>
<script language="javascript">
$(function() {
$("#slider-range").slider({
range: true,
orientation: "vertical",
min: 1,
max: 3000,
values: [0, 3000],
slide: function(event, ui) {
$("#amount").val('$' + ui.values[0]);
$("#amount1").val('$' + ui.values[1]);
}
});
$("#amount1").val('$' + $("#slider-range").slider("values", 1 ));
$("#amount").val('$' + $("#slider-range").slider("values", 0));
});
</script>