Last active
August 29, 2015 14:01
-
-
Save StephenFiser/216fb86807528958d7aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| $('#new-to-do-item').keyup(function(e) { | |
| if (e.which === 13) { | |
| var text = $(this).val(); | |
| var listItem = "<li><input type='checkbox'>" + text + "</li>" | |
| $('ul').append(listItem); | |
| } | |
| }); | |
| $('input[type="checkbox"]').click(function() { | |
| console.log(this); | |
| console.log($(this)); | |
| if (this.checked) { | |
| // or you could do if ($(this).is(":checked")) { | |
| $(this).parent().css("background-color", "#e8e8e8"); | |
| } else { | |
| $(this).parent().css("background-color", "#ffffff"); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment