javascript - get aria-valuenow property from a div - Stack Overflow

I am using rateit plugin in my webpage,and examples here: .htmI set the code for getting the 5 stars

I am using rateit plugin in my webpage, / and examples here: .htm

I set the code for getting the 5 stars div and now I want to get the value for sending to my server. Checking the code, the value is in the div in a property called: aria-valuenow but I don't know how to get the value from that. How can I access to this property?

This is the code I have to create div:

<input  type="hidden" value="4" step="1" id="backing4">
<div class="rateit"onclick="rate(this)"  data-rateit-backingfld="#backing4" data-rateit-resetable="false"  data-rateit-ispreset="true" data-rateit-min="0" data-rateit-max="5">
</div>

I tried something like this:

document.getElementById("backing4").aria-valuenow

And it says that this property doesn't exists.

I am using rateit plugin in my webpage, http://rateit.codeplex./ and examples here: http://www.radioactivethinking./rateit/example/example.htm

I set the code for getting the 5 stars div and now I want to get the value for sending to my server. Checking the code, the value is in the div in a property called: aria-valuenow but I don't know how to get the value from that. How can I access to this property?

This is the code I have to create div:

<input  type="hidden" value="4" step="1" id="backing4">
<div class="rateit"onclick="rate(this)"  data-rateit-backingfld="#backing4" data-rateit-resetable="false"  data-rateit-ispreset="true" data-rateit-min="0" data-rateit-max="5">
</div>

I tried something like this:

document.getElementById("backing4").aria-valuenow

And it says that this property doesn't exists.

Share Improve this question edited Jan 14, 2014 at 15:34 Biribu asked Jan 14, 2014 at 15:24 BiribuBiribu 3,83314 gold badges48 silver badges83 bronze badges 2
  • add somecode that you tried. – Muath Commented Jan 14, 2014 at 15:29
  • I added some code. I don't know if this is what you want – Biribu Commented Jan 14, 2014 at 15:35
Add a ment  | 

2 Answers 2

Reset to default 3

You shouldn't use the aria-valuenow attribute to get the value of your rateit ponent, you should use the following code:

Use:

$('#backing4').val();

or

$('.rateit').rateit('value'); 

Accessing aria-valuenow property from a div is as simple as writing

document.getElementById("example").ariaValueNow

and if you need to set or change it then,

document.getElementById("example").ariaValueNow = "value"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745284240a4620463.html

相关推荐

  • javascript - get aria-valuenow property from a div - Stack Overflow

    I am using rateit plugin in my webpage,and examples here: .htmI set the code for getting the 5 stars

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信