Created
August 22, 2015 10:35
-
-
Save LIttleAncientForestKami/bf33342b9671a87bdeed to your computer and use it in GitHub Desktop.
DOM manipulation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var buildTaskList = function() { | |
var ol = document.getElementById('TaskList'); | |
var list = document.createDocumentFragment(); | |
var inputEl = function(i) { | |
var el = document.createElement('input'); | |
el.setAttribute('type', 'image'); | |
el.setAttribute('src', 'ncheck.png'); | |
el.setAttribute('alt', 'Wykreśl'); | |
el.setAttribute('onclick', 'RDZ.done('+i+'); this.disabled = true; return false;'); | |
return el; | |
}; | |
var counter = this.nextKey; | |
for(i=0;i<counter;i++) { | |
var item = localStorage.getItem(localStorage.key(i)); | |
//console.log("Item "+i+" = "+item); | |
var li = document.createElement('li'); | |
li.id = i; | |
li.innerHTML = item; | |
li.appendChild(inputEl(i)); | |
list.appendChild(li); | |
} | |
ol.appendChild(list); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment