+ 2
HTML input + JS. This code is though (for me), can u help
HTML line: 13; JS line 55; There are over a 100 inputs and table td / th. I accessed them with TagName (in the js). First run the code, then the first input, in front of round and under the "players names" -- You type something in it (names[2].innerHTML = nameInp[0].value). And click "done", So then the input disappears and the first name is input.value. Issue: when I click on done again, the names[2] disappears. Why & how do u fix that? (kinda hard to explain); https://code.sololearn.com/WShYa2MbsX7l/?ref=app
15 Answers
+ 1
https://code.sololearn.com/Wy0OneUPhLUm/#html
+ 1
ODLNT Thanks. Alll fixed âïž.
đĄ
0
Ginfio
You need to increment the names collection when the "done" button is clicked, instead of leaving it at 2, that way the next table header will be assigned the next input value.
0
Cbrâ[ Not Active ] have u tried running the code (u edited)? it doesn't seem to be working.
0
ODLNT , that's what i was thinking, But i figured i didn't know how.
Can u show me how to do it / edit my code, or create new example _ please
0
let i = 2;
function update_name(){
names[i].innerHTML = nameInp[0].value;
i++
}
0
Cbrâ[ Not Active ] did u remove the code (u edted), for some reason i'm not seeng it on here.
0
ODLNT , it doesn't seem to work for me > let i = 2;
function . . .
}
0
Ginfo
let i = 2; should be outside of the update_name function
0
ODLNT AwosomeđĄ,
now can we limit it to only the top 10 inputs,
0
Ginfio
Now that you are using the variable i to increase the names index you can also use it to check if the done button has been pressed 10 times using an if statement.
0
ODLNT ,
Ok, and how do u do that?
// !(it sounds like i'm makin u do everything or asking too much, but really these are the things i don't know how to do)!
0
ODLNT Something like this? (it ignored what i wrote though,
https://code.sololearn.com/WShYa2MbsX7l/?ref=app
it looks right, but doesnt work