Can someone help me figure out why this code is not reading the value correctly?
This is the HTML:
<a class="InterestLink">Click me</a>
<div id="InterestExpander">
<div id="InterestExpanderX">
×
</div>
<br><br>
General Rating:
<span class="RatingGeneralNumber">80%</span>
</div>
CSS:
<a class="InterestLink">Click me</a>
<div id="InterestExpander">
<div id="InterestExpanderX">
×
</div>
<br><br>
General Rating:
<span class="RatingGeneralNumber">80%</span>
</div>
And here is the jQuery:
$('.InterestLink').click(function() {
$('#InterestExpander').fadeIn(450);
if (parseInt($('.RatingGeneralNumber').val()) > 50 ) {
$('.RatingGeneralNumber').css({"color":"green"});
}
});
$('#InterestExpanderX').click(function() {
$('#InterestExpander').fadeOut(250);
});
I have another question as well. My website will have links to different movies, each triggering a pop-up with a unique rating based on the database. Should I use an "ID" or a "Class" for the span containing the movie rating, or neither?