Reputation: 83
I have a Problem Regarding the JQuery Progress Bar.
I Need to set the Value of the Progress bar with the Value stored in a Javascript Variable.
$(document).ready(function ()
{
var text = $('.Gadget').find('input[name="Percentage"]').val();
$(function()
{
$( ".ProgressBar" ).progressbar({
value: 59
});
});
});
The Above code works fine, but as there is Value 59 the value is always Constant.
What I Really need is that instead of the 59, there will be the value of the text Variable.
Note: if I Put Value:text, the Progress bar disappears
Thank You, Andrew Borg
Upvotes: 1
Views: 3961
Reputation: 30095
You need to do it in the single document.ready handler. Use parseInt()
to make it numeric:
$(document).ready(function () {
var text = $('.Gadget').find('input[name="Percentage"]').val();
$( ".ProgressBar" ).progressbar({
value: parseInt(text)
});
});
Upvotes: 4