Skip to content

Instantly share code, notes, and snippets.

@jakul
Last active January 3, 2016 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakul/8417290 to your computer and use it in GitHub Desktop.
Save jakul/8417290 to your computer and use it in GitHub Desktop.
# CSS
.like-red .red {
display:block;
}
.like-red .green {
display:none;
}
.dont-like-red .red {
display:none;
}
.dont-like-red .green {
display:block;
}
# HTML WHEN LIKES RED
<div class="colour-row like-red">
<p class="red">RED</p>
<p class="green">GREEN</p>
</div>
# HTML WHEN LIKES GREEN
<div class="colour-row dont-like-red">
<p class="red">RED</p>
<p class="green">GREEN</p>
</div>
# JAVASCRIPT ON CLICK OF 'I LIKE RED' BUTTON
$('tr.colour-row').addClass('like-red').removeClass('dont-like-red')
# JAVASCRIPT ON CLICK OF 'I DONT LIKE RED' BUTTON
$('tr.colour-row').removeClass('like-red').addClass('dont-like-red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment