Skip to content

Instantly share code, notes, and snippets.

@plusjade
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plusjade/bdcd37fea934e98bb537 to your computer and use it in GitHub Desktop.
Save plusjade/bdcd37fea934e98bb537 to your computer and use it in GitHub Desktop.
<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