开发者

How to get current value of progress bar with jQuery?

开发者 https://www.devze.com 2023-03-10 21:55 出处:网络
I\'m trying out some new HTML5 form features in the latest version of Opera. <progress value=\"1\" max=\"10\"></progress>

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

精彩评论

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