jquery - show textbox when checkbox checked

后端 未结 7 740
伪装坚强ぢ
伪装坚强ぢ 2021-01-21 08:44

I have this form

7条回答
  •  难免孤独
    2021-01-21 09:22

    Put a div across your checkbox and text box

    
    

    and replace your jquery code with this one below,

    jQuery(document).ready(function($) {
       $('input.maxtickets_enable_cb').change(function(){
           if ($(this).is(':checked')) $(this).parent().children('div.max_tickets').show();
           else $(this).parent().children('div.max_tickets').hide();
       }).change();
    });
    

    I have tested it and it works.

提交回复
热议问题