-2

I came across this code portion in one of my forms

<script> function coverUp() {

document.getElementByClass("private").innerHTML
= "X";
 }
<script>

Im pretty new to learning javascript so am unfamiliar with where the elements are involved in here

  • 2
    What it does is result in a TypeError. – CertainPerformance May 14 '21 at 17:51
  • It would return an error. If it was *correct* (misses **s** after "Element" and `[0]` before `.innerHTML`) then it would replace the content of an element with the class "private" to just `x` – VLAZ May 14 '21 at 17:52
  • 2
    There is no `getElementByClass` in native JS. There is however, `getElementsByClassName()` – j08691 May 14 '21 at 17:52

0 Answers0