Reputation: 51
I want to use progressive bar in my HTML page.i am using 'progress', the value is not being replicated when i am binding ko variable with the progressive bar.
How do I add value as a text in the middle of the progressive bar?
function myFunction1() {
return document.getElementById("myProgress").value = "75";
//Actually the value 75 is coming from the ko variable.I can print this variable.
//Only issue in updating the value in progress
}
<progress id="myProgress" value="javascript:myFunction1()" max="100"></progress>
Upvotes: 2
Views: 701
Reputation: 848
What it looks like you are doing is using the function return value for the value of your progress bar. Sadly, this function is only evaluated once. I'd advice for binding the ko.observable
directly on your progress bar like this:
<progress id="myProgress" data-bind="attr: { value: myProgressObservable }" max="100">
</progress>
Ps; See the knockout docs for more information about the attribute binding http://knockoutjs.com/documentation/attr-binding.html
Upvotes: 1