javascript Hide/show div on checkbox: checked/unchecked

前端 未结 4 1624
我寻月下人不归
我寻月下人不归 2020-12-19 19:24

I am trying to make a function in javascript, that will hide / show particular div in my registration form, depending on the state of my checkbox (checked or not). Here is

4条回答
  •  既然无缘
    2020-12-19 19:43

    You are correct in using display: none; to hide your DIV initially.

    As for your checkbox, try removing the spaces between getELementById and ('powermail_field...

    Also you need to change:

    } else {elem.display:none;}
    

    to:

    } else {elem.display = 'none';}
    

提交回复
热议问题