jQuery radio button show div

前端 未结 4 712
余生分开走
余生分开走 2021-01-15 18:53

Hey guys, what function could I use to say, if this radio button is checked show this \'div\'. Thanks in advance.

4条回答
  •  广开言路
    2021-01-15 19:49

    This is what I use. Replace “mydiv” with the id of your radio button and “content1” with the content you want to show/hide.

    Post some html if you need further help.

    $(document).ready(function(){
       $('#content1').hide();
    
       $('a').click(function(){
          $('#content1').show('slow');
       });
    
       $(‘#mydiv’).click(function(){
          $('#content1').hide('slow');
       })
    });
    

    Rick

提交回复
热议问题