1

I am trying to get value from Jrate Plugin for example when the using click on 3rd start the value should i get should must be 3.and i can get it on using jRate onSet option Here is my HTML

<div id="jRate"></div>

And My Javascript is

  $("#jRate").jRate({
        onSet: function(rating) {
                   alert("Selected Rating: "+rating);
             }
    });

but i dont want to get the value on onSet function i want value when user click on save button just like how we get value from inout box

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

Is their any way i can get value like this..

1 Answers1

3

One way is to set a custom attribute. You can do this on the #jRate element

$("#jRate").jRate({
        onSet: function(rating) {
                   $("#jRate").attr("data-rating", rating);
             }
    });

then, later in the click handler

$("button").click(function(){
    var rating = $("#jRate").attr("data-rating");
});
AmmarCSE
  • 30,079
  • 5
  • 45
  • 53