if check box is checked display div

后端 未结 3 2021
庸人自扰
庸人自扰 2021-02-10 14:57

I\'m trying to build something like wordpress options for toggling fields visibility when creating and article. What I\'ve build is relying on the $.click function

3条回答
  •  名媛妹妹
    2021-02-10 15:15

    HTML

    
    
    Some text here

    css

    #block{display:none;background:#eef;padding:10px;text-align:center;}
    

    javascript / jquery

    $('#cbxShowHide').click(function(){
    this.checked?$('#block').show(1000):$('#block').hide(1000); //time for show
    });
    

提交回复
热议问题