After deepening, I managed to find out the problem. It all came down to the fact that PHP loads before JavaScript.
PHP . ajax getRating(work_id, selectorToWriteTo), .
ajax :
<div class="ui small star rating" data-rating="3" data-max-rating="5">Leave rating</div>
javascript, . , document.ready() :
$( document ).ready(function() {
$('.ui.small.rating').rating();
});
, , , , , , PHP-, PHP , .
- JavaScripts window.onload, :
window.onload = function(event){
event.stopPropagation(true);
$('.ui.small.rating').rating();
}
, , , onload .
- , , , , , .
.
UPDATE:
. setTimeOut:
window.onload = function(event){
setTimeout(function(){
event.stopPropagation(true);
$('.ui.small.rating').rating('disable');
}, 0);