Why does != work and just = doesn't?

后端 未结 6 410
陌清茗
陌清茗 2021-01-29 15:41

Here\'s my code:

  if (document.getElementById(\"hiddenButton\").style.visibility != \"visible\") {
     document.getElementById(\"hiddenButton\").style.visibili         


        
6条回答
  •  无人共我
    2021-01-29 16:27

    I think your problem is that you are confusing the assignment operator ( = ) with the equality operator ( == or ===). the assignment operator set the left hand side equal to whatever is on the right hand side, and the equality operator ( == or === ) actually tests for equality.

提交回复
热议问题