I am a win32 amateur coder and a newbie web programmer. For my personal project I am trying to modify a to-do list code in codepen.
http://codepen.io/arjancodes/pen/Bahkb
Here is my code:
// get rid of default value in input box
$('input[name=toDoItem]').focus(function() {
$(this).val('');
})
$('#add').click(function() {
var $input = $('input[name=toDoItem]').val();
if ($input.length > 0) {
$('#list').append('<li class=' + 'close' + '>' + $input + '</li>');
} else {
alert("We'd all love to do nothing.");
}
// reset input box to no text
$('input[name=toDoItem]').val('');
});
// remove list item
$('#list').on('click', '.close', function() {
$(this).hide('2000', function() {
$(this).remove();
});
});
In this to do list project, when clicking on "x" button, it deletes the row. But when I click to text, it also deletes. What I am going to do, is to separate delete button and text. User will write a link to input box and add it to list. After that user will click to text and the page will redirect to the link. I am hoping someone can show me the right direction, I am not asking to write all the code for me!