Reputation: 11
I want to make a jQuery progress bar where the value is that of an variable.
var mynumber = [whatever value]
$(function () {
$("#progressbar").progressbar({
value: mynumber
});
});
I have searched on the net but can't find this anywhere. Thanks!
Upvotes: 0
Views: 1088
Reputation: 6795
you need to link JQueryUI and JQuery, look at this code:
HTML
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<div id="progressbar"></div>
JQuery
var number=37;
$( "#progressbar" ).progressbar({
value: number
});
CSS
div{
width:300px;
height:30px;
}
Upvotes: 0
Reputation: 9150
As value
can be of the type boolean
or number
(according to the jQuery API), you have to parse your variable into the specific type first:
var mynumber = [whatever value]
$(function () {
$("#progressbar").progressbar({
value: parseInt(mynumber, 10)
});
});
Upvotes: 1