0

Note: i searched a half hour. I need a special solution for this:

I have the folowing code already (node some Variables have german Names i hope that's ok)

function generateList () {


document.getElementById("liste").innerHTML =""

var listEasy = vorNameListe[i] + " " + nachNameListe[i] + " " + alterListe[i]

for (var i=0; i < vorNameListe.length; i++) {

document.getElementById("liste").innerHTML += "<li>" + listEasy + "</li>"
};

Now i need a javascript (pls no jquery) solution so the user can change every List entry by himself. How do i do that?

further explanation: The code i have is one to bring a "li" in a existing "ul" with every loop. But then i want to give every "li entry" the ability to be changed by the user.

Sain Linkerty
  • 63
  • 2
  • 13
  • You can't use `i` outside the loop. – RodrigoDela Jan 22 '15 at 15:46
  • Whats your point? The loop works! – Sain Linkerty Jan 23 '15 at 08:56
  • PS I dont want to use [i] outside the loop... – Sain Linkerty Jan 23 '15 at 09:20
  • In your example you clearly do. – RodrigoDela Jan 23 '15 at 09:23
  • In my example i set a var called listEasy. Then I set the var list Easy in the for loop. so in the End its like this: for (var i=0; i < vorNameListe.length; i++) { document.getElementById("liste").innerHTML += "
  • " + vorNameListe[i] + " " + nachNameListe[i] + " " + alterListe[i] + "
  • "}; i hope now you get it. its not that i dont now about scopes, i just used a var to make it clearer. If u dont undertsand it, forget about it, i need something to Edit my
  • entrys.
  • – Sain Linkerty Jan 23 '15 at 09:36
  • Maybe I should just correct my comment. You should't do such things. It just makes your code less maintainable. I know that it works that way, but in a more complex project this could cause you some trouble. – RodrigoDela Jan 23 '15 at 18:49
  • OKay in my next projekt i will keep this in mind. – Sain Linkerty Jan 26 '15 at 08:44