if you want to chane css when value changes try:
var bar = $('#progressbar');
bar.change(function() {
$(this).css('opacity',parseInt($(this).val())/100);
});
EDIT As far as I understood, that you need to style the strip, that presents the value, I have to edit my answer heavily. In fact, I didn't investigate a way to manipulate css pseudo-selectors using jQuery and/or JavaScript, but there's the way to do it creating a stylesheet and changing it dinamically. Here it goes:
$(document).ready(function() {
var style=document.createElement("style");
var sheet = document.head.appendChild(style).sheet;
var bar = $('#progressbar'); // your progress bar
// first of all, i create first rule
sheet.insertRule('progress::-webkit-progress-value{ background-color: rgb('+bar.val()+','+bar.val()+','+bar.val()+');}');
bar.change(function() {
// because here it throws an error if no 1st rule
sheet.deleteRule(0);
sheet.insertRule('progress::-webkit-progress-value{ background-color: rgb('+bar.val()+','+bar.val()+','+bar.val()+');}');
});
});
I didn't test the code above (just changed it here), but it gives a basic representation what to do. Here is working example with "plus" button, that increases value and changes backgroung-color
of exactly value bar
I'm also dissapointed, that HTML5+JS is so poor in this, maybe later...
EDIT2 actually change()
for <progress>
doesn't work in jQuery for some reason (it doesn't mean real javascript object doesn't have onchange
property), so this example will not really work
check out UPDATED DEMO