Search code examples
javascriptjqueryraty

raty and jQuery.noConflict


I'm trying to integrate raty to running webapplication. For several reasons jquery is used with jQuery.noConflict. In this case $ is replaced by $j. The thing is I can't get it work with this $j. Here's what I'm doing (I have noticed that it's partly works when I set readonly: true)

$j(document).ready(function () {

            $j('#divraty').raty({                
                path: '/images/raty',
                score: 4,
                click: function (score, evt) {
                    alert('ID: ' + $j(this).attr('id') + "\nscore: " + score + "\nevent: " + evt);
                }
            });
}

I have noticed that it's partly works when I set readonly: true (the 4 stars are showed and no error in the console)

Here's what the console says: Uncaught TypeError: Object # has no method 'on'

I try replacing all $ by $j in the jquery.raty.js but it doesn't change anything.

Any idea how to solve this?


Solution

  • You need to use jQuery >= 1.7 since raty plugin uses .on().

    Also there is no need to modify jquery.raty.js file since it handles the noConflict internally