I have a page with lots of comments.
The code structure is as follows:
+ <li id="li-comment-65" class="comment even thread-odd thread-alt depth-1">
<div class="comment-body">
<div id="comment-65">
<div class="comment-author vcard">
<img height="30" width="30" href="" alt="" />
<cite class="fn">keith</cite>
</div>
<div class="comment-meta commentmetadata">
<a href="#">June 16, 2009 at 10:21 pm</a>
</div>
<div id="rating-65" class="rating-class">Excellent</div>
<p>Hiya</p>
</div>
</div>
</li>
What I want to do is the following:
- Get the value from each ‘rating-class’ class.
(There will be a maximum of 5 values:
a. Excellent
b. Very Good
c. Good
d. Poor
e. Very Poor - If rating == ‘Excellent’ – Display a 5 star image and remove the ‘Excellent’ text
- If rating == ‘Very Good’ – Display a 4 star image and remove the ‘Very Good’ text
- …
- …
- etc
Is this hard to do?
This should do it:
Even better would be to do something like this:
And then have CSS classes like these:
Where the text-indent would hide the regular text you originally had there.