<script src="http://code.jquery.com/jquery-latest.js"></script> <input class="synchronize" type="checkbox" /> <script type="text/javascript"> $(".synchronize").change(function(){ $(this).toggleClass("on"); alert($(this).attr("class")) }); </script>