I am using the slider from jQuery UI and would like to insert the slider value into the form. How do I actually do that? Below is the code snippet for my form.
Thanks.
$("#slider").slider({ max: 200000,step:50,
change: function(event, ui) {
$('what_to_insert_here').empty().append(ui.value);
}
});
<form action='/submit' method="POST">
<div class = 'form'>
<label>SliderValue:</label>
<input type="text" name="Value" > </input>
</div>
<input type="submit" value="Submit!" />
</form>
If I understand your question correctly, then you have two steps to fulfill:
<input type="text" name="Value" > </input>to<input type="text" name="Value"/>. Theinputtag has no closing tag.$("#slider").slider({ max: 200000, step:50, change: function(event, ui) { $(".form input[name='Value']").val( ui.value ); } });What we do with the jQuery is set the
valueattribute of theinputelement inside the div with the classformto whateverui.valueequals.