Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("div.hidden").click(function(){
- $(this).addClass("orange");
- });
- $("div.orange").click(function(){
- $(this).removeClass("orange");
- });
- <div class="hidden"></div>
- .hidden{
- width:100px;
- height:100px;
- float:left;
- background-color:#ccc;
- margin-bottom:5px;
- margin-right:5px;
- }
- .orange {background-color:#F90;}
- $("div.hidden orange").click(function(){
- $(this).removeClass("orange");
- });
- $("div").click(function(){
- $(this).toggleClass("orange");
- });
- var $div = $('div.hidden');
- if ($('div.hidden').hasClass('orange')) {
- $div.removeClass('orange');
- }
- else $div.addClass('orange');
- $("div.hidden").click(function(){
- if ($(this).hasClass("orange")) {
- $(this).removeClass("orange");
- } else {
- $(this).addClass("orange");
- }
- });
- $("div.hidden").click(function(){
- $(this).toggleClass("orange");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement