something like:
$("a.starRating").each(function(){
var $this = $(this);
var href = "" ;
var stars = $this.text();
$this.empty();
for (var i = 0; i < stars.length; i++){
$this.append("<span class = '" + (i+1) + "'>" +
stars.substr(i,1) + "</span>");
}
$this.children('span').click(function(){
$.get(href,{rating: this.className});
$this.children('span').removeClass("selected");
$(this).addClass("selected");
return false;
})
});
rate me<a class="starRating" href=""
dom tested , but I didn't write the cgi or the styles.
PS
those are utf-8 stars in the <a>
Interesting. I wrote a unobtrusive star rating system based on form elements and select elements. It would take a structure like this:
<select>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
and create the star rating interface. I will try and jQueryizeify :) that today.
-Wil
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/