开发者

How to get current value of progress bar with jQuery?

I'm trying out some new HTML5 form features in the latest version of Opera.

<progress value="1" max="10"></progress>

What I want to do is to get the current value of the progress bar using jQuery.

I tried...

$(function(){
    alert($('progress').val());

});

...but it didn't do anything.

How can I get the cu开发者_StackOverflow中文版rrent value using jQuery?


Using jQuery's val() threw an error for me, so I used the native value property.

var value = $('progress:first').prop('value'); 

jsFiddle.

If using < 1.6, then use [0].value to access the native value property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜