In the view in Razor, I pass in a model that contains a list ('usageList') of objects that have the Name property and UseDescription.
In jQuery, I created a slider, and I want a specific UseDescription to appear when the slider value changes.
The problem is getting a specific object in the list inside the model. I have this code (jQuery):
<script type="text/javascript"> $(document).ready(function() { $("#slider").slider({ min:1, max:3, value:1, range:"min", change: function(event,ui){ var number = ui.value; alert("@Model.UsageList[ui.value].UseDescription"); } }); }); </script>
impossible to get ui.value on this line:
alert("@Model.UsageList[ui.value].UseDescription");
If I pass a number (1 for expample) instead of ui.value, everything will work fine. But I need to get a specific list.
Any help is greatly appreciated.
source share