JS/app.js
//Funcao que renderiza as tarefas na lista
Funcao que renderiza as tarefas na lista
Funcao que renderiza as tarefas na lista
function renderTarefas(){
    listElement.innerHTML = '';
    for (tarefa of tarefas){
        var tarefaElement = document.createElement('li');
        var tarefaText = document.createTextNode(tarefa);
        var linkElement = document.createElement('span');
        var pos = tarefas.indexOf(tarefa);
        linkElement.setAttribute('onclick', 'deleteTarefa('+ pos +')')
        linkElement.setAttribute('class', 'glyphicon glyphicon-remove');
        tarefaElement.appendChild(tarefaText);
        tarefaElement.appendChild(linkElement);
        listElement.appendChild(tarefaElement);        
    }
}
function renderTarefas ( ) { listElement . innerHTML = '' ; for ( tarefa of tarefas ) { var tarefaElement = document . createElement ( 'li' ) ; var tarefaText = document . createTextNode ( tarefa ) ; var linkElement = document . createElement ( 'span' ) ; var pos = tarefas . indexOf ( tarefa ) ; linkElement . setAttribute ( 'onclick' , 'deleteTarefa(' + pos + ')' ) linkElement . setAttribute ( 'class' , 'glyphicon glyphicon-remove' ) ; tarefaElement . appendChild ( tarefaText ) ; tarefaElement . appendChild ( linkElement ) ; listElement . appendChild ( tarefaElement ) ; } }
Funcao que renderiza as tarefas na lista
Funcao que renderiza as tarefas na lista
//Limpar a lista antes de renderizar para nao duplicar valores //Cria a lista/texto/link e texto para exluir item //Anexa os elementos a UL para renderizacao