Exercise (05)

Implement exercise (04) as jQuery plugin. When done, all you should need to do is $('#rating').rating({url: 'http://path.to/script'}); to achieve the same result.

by bombo

HTML

<h3>Rating</h3>
<div id="rating">
</div>

CSS

h3 {
    margin: 8px 0;
    font-family: sans-serif;
    text-decoration: underline;
}

JavaScript

(function($) {

    $.fn.rating = function (options) {
    
        var $this = this;
        
        // plugin code here  
        
        return $this;
    };
    
})(jQuery);

$(function () {
    $('#rating').rating({url: 'http://suppenzauber.com/rate/rate.php'});
});