"Toggle Class (Add or Remove Class)"
Bootstrap 3.0.0 Snippet by xrozix

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container main"> <div class="row"> <h2 class=color-change>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> </div> </div>
.main { height:500px; background:#f33; } .yellow { background:yellow; }
$(document).ready(function(){ $(".color-change").click(function(){ $(".main").toggleClass("yellow"); }); });

Related: See More


Questions / Comments: