Changing jQuery Raty ReadOnly value after user click

I want to make Raty read-only on click event, but it doesn't work:

            $('#number').raty({
            click: function(score, evt) {
                readOnly: true; //it does not work here
                $.get(
                "../../ajax/test.aspx",
                {r:score},
                function (data) { alert(data); },
                "html"
        );

                },
            scoreName: 'entity.score',
            number: 10

            });

      

Raty Home Page

+3


source to share


1 answer


You need to cancel click events on img

$('#star').raty({
    click: function(score, evt) {
        $(this).find('img').unbind('click');
        // $(this).find('img').unbind(); <-- this removes all listeners
    }
});
โ€‹

      



http://jsfiddle.net/xnZVd/

+7


source







All Articles