Why can not I type text in the input ".add-edit" that was created with jQuery ?
$(function(){
function onTarefaDeleteClick(){
$(this).parent('.tarefa-item').hide('slow', function(){
$(this).remove();
});
}
$('.tarefa-delete').click(onTarefaDeleteClick);
});
$(function(){
function onTarefaItemClick(){
var text = $(this).children('.tarefa-texto').text();
var html = '<input type="text" ' + 'class="tarefa-edit" value="' + text + '">';
$(this).html(html);
$('.tarefa-edit').keydown(onTarefaEditKeydown);
}
$('.tarefa-item').click(onTarefaItemClick); //
});
function onTarefaEditKeydown(event){
if(event.which === 13){
savePendingEdition($(this));
}
}
function savePendingEdition(tarefa){
console.log('...');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="todo">
<h2>TODO List</h2>
<input type="text" id="tarefa">
<div id="tarefa-lista">
<div class="tarefa-item">
<div class="tarefa-texto">Comprar pão</div>
<div class="tarefa-delete"></div>
<div class="clear"></div>
</div>
</div>
</div>