SO - 18804359
by Arun P Johny
HTML
<form>
<div>
<label for="todo">I need to:</label>
<input type="text" id="todo" />
</div>
<button id ="add" type="button">Add to your to-do list!</button>
</form>
<ul>
</ul>
JavaScript
$(document).ready(function() {
$('#add').click(function() {
var item = $('#todo')
$('ul').prepend("<li>"+item.val()+"</li>");
});
$('ul').on('click', 'li', function() {
$(this).remove();
});
});