JRate如何使用jquery或javascript从选定的星星中获取价值并将其存储在数据库中 [英] JRate How to get value from selected star and store it in database using jquery or javascript

查看:102
本文介绍了JRate如何使用jquery或javascript从选定的星星中获取价值并将其存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Jrate插件获取值,例如,当使用单击第三次启动时,我应该获取的值必须为3,并且我可以使用jRate onSet选项获取它 这是我的HTML

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>

我的Java语言是

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

但是我不想在onSet函数上获取值,我想在用户单击保存按钮时获取值,就像我们如何从inout框中获取值

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..

推荐答案

一种方法是设置自定义属性.您可以在#jRate元素

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);
             }
    });

然后,稍后在click处理程序中

then, later in the click handler

$("button").click(function(){
    var rating = $("#jRate").attr("data-rating");
});

这篇关于JRate如何使用jquery或javascript从选定的星星中获取价值并将其存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆