チェックボックスにチェックしたらコンテンツを表示させる

Ads

Result

jQuery

$('#check').click(function() {
    //クリックイベントで要素をトグルさせる
    $("#box").slideToggle(this.checked);
});

css

input{margin:80px 0 0 80px;}
div{
    display:none;
    margin:25px;
    padding:25px;
    background:#eee;
    width:200px;
    height:150px;
}

html

<label><input type="checkbox" id="check">Check This!</label>
<div id="box">content is here</div>
タイトルとURLをコピーしました