0

I'm still learning JS, how to place inner text to a same multiple td at once using JavaScript ? I'm trying to place "working Time" to multiple td element that have same id name which is "cellWork" but in my input it doesn't show :S why ?

enter image description here

mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • 1
    Welcome to Stack Overflow! Please visit the [help], take the [tour] to see what and [ask]. Do some research, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. Post CODE, not PICTURES of code – mplungjan Feb 24 '21 at 15:52
  • Change id to class. IDs need to be unique. Then do `const yesChecked = yes.checked; document.querySelectorAll(".cellWork").forEach(cell => cell.innerText = yesChecked ? "working time" : "free time");` – mplungjan Feb 24 '21 at 15:55
  • 1
    mpliungjan , YOU SAVED MY LIFE DUDE YOU ARE THE BEST <3 – Maani codes Feb 24 '21 at 16:24

0 Answers0