I\'m learning jQuery and was following a tutorial, a very strange error has perplexed me. Here\'s my html :
I've modified your script to work with jQuery, if you wish to do so.
$(document).ready(function(){
//To add a task when the user hits the return key
$('#task-text').keydown(function(evt){
if(evt.keyCode == 13)
{
add_task($(this), evt);
}
});
//To add a task when the user clicks on the submit button
$("#add-task").click(function(evt){
add_task($("#task-text"),evt);
});
});
function add_task(textBox, evt){
evt.preventDefault();
var taskText = textBox.val();
$("").text(taskText).appendTo("#tasks");
textBox.val("");
};