I want to set the inital value of a Jquery slider, but I want to do it inline with HTML and not in the Jquery.

This is working:

<div class='slider' id='slid1' data-inp='inp1'></div>
<script>
    $(function() {
    $(".slider").slider({ value: 30 });
});
</script>

but I want to use something like this in razor, but can't get it to work. I want to use it in a Razor foreach, so passing a dynamic parameter to the Jquery can also work.

<div class='slider' id='slid1' data-inp='inp1' value=30></div>
<script>
    $(function() {
    $(".slider").slider();
});
</script>

Related posts

Recent Viewed