Q:

How do I do this in Jquery?  It's about classes and adding something to the tag

<script type="text/javascript">
var Average_rating = a number between 1 and 5
</script>
<select name="rate">
         <option value="1" class="p_rating_star" />Not so great</option>
         <option value="2" class="p_rating_star" />Quite good</option>
         <option value="3" class="p_rating_star" />Good</option>
         <option value="4" class="p_rating_star" />Great!</option>
         <option value="5" class="p_rating_star" />Excellent!</option>
</select>

I am building a rating system. 
How do I use JQuery to add "selected = selected"  to one of the option values, depending on the average_rating? 
How can I say...
Add "selected = selected" to anything with class "p_rating_star" where average_rating = that class's value (1-5)? 

A:

$(".p_rating_star[value=" + average_rating + "]").attr("selected", "selected");

