Last active
August 29, 2015 14:12
-
-
Save plusjade/bdcd37fea934e98bb537 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
<form> | |
<input name="item"> | |
<button type="submit">Add Item</button> | |
</form> | |
<ul id="todo-items"> | |
<li>Item 1</li> | |
<li>Item 2</li> | |
<li>Item 3</li> | |
</ul> | |
<script> | |
// Now some unobtrusive javascript: | |
$('form').submit(function(e) { | |
e.preventDefault(); | |
var content = $('form').find('input').val()); | |
$("#todo-items").append($('<li></li>').text(content)); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment