IF Statement Always True

You need to use == or === for comparison instead of =.

  • x = y assigns y to x
  • x == y checks if y and x are loosely equal
  • x === y checks if y and x are equal and of the same type

So what you need to do is replacing if (hv.val = "1") with if (hv.val == "1")

Leave a Comment