I need to toggle between 3 states
How would this be possible? Beside changing a class I also need to make an ajax call at the same time.
What I basically just want is a selected, not selected toggle and I have no idea how to detect is a user clicked the grey box the first time
For starters I now have:
<div id="test" onclick => "$(this).toggleClass('selected_yes')"> test <div>
Well you can still use toggle
:
$('#test').click(function() {
if (this.className.match(/green|red/)) $(this).toggleClass('green red');
else $(this).toggleClass('green');
// ajax call here
});