Reputation: 1521
Here is a link to the jsfiddle: http://jsfiddle.net/ekimm2/LcLAA/
When I try to color one of the unicode stars upon clicking, nothing happens. I'm sure its something trivial but I cant seem to fix it. Any thoughts? I put the javascript below, but the rest I left in the jsfiddle for simplicity purposes.
$(document).ready(function() {
$('.stars').click( function()
{
$(this).css('color', 'ffd700')
});
});
Edit: Sorry about that, I had to make an account, it should be fixed now
Upvotes: 1
Views: 114
Reputation: 17272
There were a few problems with your javascript and fiddle. See this fiddle which is an update of yours with problems fixed. Problems were:
I have changed to add margin-top:10%;
and use nextAll
and set the colour on the current element.
Upvotes: 0
Reputation: 10698
Using a hash does works, as Ashley mentioned it.
If you include jQuery in your fiddle, and remove your $(document).ready()
, it barely works (I mean, the color is changing, but not the way you intended it).
I think the actual problem is not the color, but the fact you're misusing prevAll()
, as your elements are floated right. See this fiddle.
Note : You might either reconsider your question, or amend an edit, so we could help you & stay in the question's scope if you wish. Either, I'll move this to a comment.
Upvotes: 0
Reputation: 7309
Use a hash(#) for colour and add a semicolon(;).
$(this).css('color', '#ffd700');
See fiddle.
Upvotes: 1