I’m trying to allow the user to click between 1-4 options. They can pick one or all 4.
Here is the jsfiddle .
<a class="selector" href="#"><h2 class="unselected">Option 1</h2></a>
<a class="selector" href="#"><h2 class="unselected">Option 2</h2></a>
<a class="selector" href="#"><h2 class="unselected">Option 3</h2></a>
<a class="selector" href="#"><h2 class="unselected">Option 4</h2></a>
$("a.selector").click(function(){
$(this).children("h2").removeClass('unselected').addClass('selected');
});
It’s a simple, but I can’t get it. What am I doing wrong?
It works as soon as you add jQuery to the fiddle : http://jsfiddle.net/CjCM4/
No need to change the code :
(see menu on the left)