$(function() { $('#content #show').hide(); }); $('#switchShow').change(function() { if ($(this).prop('checked')) { $('#content #show').show(); } else { $('#content #show').hide(); } });
<h1>jQuery</h1> <div id="content"> <label> <input type="checkbox" id="switchShow"> show </input> </label> <p id="show">Yeah!!</p> </div>