In addition to the common API methods that are exposed by all library components, such as destroy
, disable
, enable,
and option
, the slider API also exposes the value
method which is a shortcut for using the option
method to set the value
of the progressbar.
For example, we can do exactly the same as we did in the last example, but with less code using the value
method. Change the final <script>
element in progressbar3.html
so that it is as follows:
<script type="text/javascript"> $(function() { $("#progress").progressbar(); $("#increase").click(function() { var currentval = $("#progress").progressbar("option", "value"), newval = currentval + 10; (newval > 90) ? $(this).attr("disabled", "disabled") : null; if(currentval < 100) { $("#progress").progressbar("value", newval); ($("#value").length === 0) ? $("<span>").text(newval + "%").attr("id", "value").css({ float...