Hello all
I have got a slider working in an ASPnet MVC application. I need to show and hide the slider when the user clicks into the field. am struggling to get this part working.
What I have is
- <script type="text/javascript">
- $(function () {
- $("#SundaySlider").slider({
- range: "max",
- min: 1,
- max: 10,
- value: 2,
- slide: function (event, ui) {
- $("#SundayHours").val(ui.value);
- }
- });
- });
- </script>
And then in my MVC form using Razor syntax
- <div class="form-group">
- @Html.LabelFor(model => model.SundayHours, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.TextBoxFor(model => model.SundayHours, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.SundayHours, "", new { @class = "text-danger" })
- <br /><br />
- <div id="SundaySlider" style="width:200px"></div>
- </div>
-
- </div>
This gives me a slider below the box but I only want the slider to display when the user clicks into the box.
Hopefully this makes sense
Thanks for reading
Cheers