How to only show input fields if checkbox is checked?

前端 未结 6 2312
小鲜肉
小鲜肉 2021-01-02 12:40

Basically, I want to only show these fields if checkbox is selected, if it becomes unselected, disappear.



        
6条回答
  •  攒了一身酷
    2021-01-02 13:44

    You can do this with pure CSS3, of course:

    :checked + #date { display: block; }
    #date { display: none; }
    

    The equivalent selectors ought to work just fine in jQuery as well.

提交回复
热议问题