JSFiddle - React, Tailwind, and code Playground
HTML
<div id="star_rating"><a href="#">Test</a></div>
JavaScript
function test () {
this.rating = 0;
var oldThis = this;
$('#star_rating a').click(function() {
alert(oldThis.rating);
return false; // <== so page doesn't refresh
});
}
var foo = new test();