How to only show input fields if checkbox is checked?

前端 未结 6 2355
小鲜肉
小鲜肉 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:43

    Try this:

    $('input[name=supplied]').live('change', function(){
         if ( $(this).is(":checked")) {
             $('#date').show();
         } else {
             $('#date').hide();
         }
     });
    

提交回复
热议问题