Search code examples
jquery-ui-slider

jQuery ui Slider value not reading


I created value slider with jQuery.

<div class="specialSearch">
    <form action="#" method="GET">
        <script type="text/javascript">
             $(function() {
                $( "#juiSlideIMDB" ).slider({
                    value: 7.0,
                    min: 0.0,
                    max: 9.9,
                    step: 0.1,
                    slide: function(event,ui){
                        $(".specialSearch form div b").val(ui.value);
                    }
                });
                $(".specialSearch form div b").val($("#juiSlideIMDB").slider("value"));
            });
        </script>
        <div>IMDB Vote: <b></b></div>
        <div id="juiSlideIMDB"></div>
    </form>
</div>

This code, specialSearch form div b value doesn't change. But, this line:

$(".specialSearch form div b").val($("#juiSlideIMDB").slider("value"));

to

$(".specialSearch form div b").text($("#juiSlideIMDB").slider("value"));

val -> text not in the current. So, changing once. It for the first value.

Slider tries values(.specialSearch form div b) ​​change.

How do we do?

Thank you for your interest.


Solution

  • I am solved. Thanks..

    <div class="specialSearch">
        <form action="#" method="GET">
            <script type="text/javascript">
                 $(function() {
                    $( "#juiSlideIMDB" ).slider({
                        value: 7.0,
                        min: 0.1,
                        max: 9.9,
                        step: 0.1,
                        slide: function(event,ui){
                            $("#imdbVote").val(ui.value);
                        }
                    });
                    $("#imdbVote").val($("#juiSlideIMDB").slider("value"));
                });
            </script>
            <div>IMDB Vote: <input readonly="readonly" type="text" id="imdbVote" /></div>
            <div id="juiSlideIMDB"></div>
        </form>
    </div>
    

    imdbVote css;

    #imdbVote{position:absolute;border:0;color:#f6931f;font-weight:bolder;width:25px;}