Wrap your code in a loading event. This is the newer, preferred, syntax (rather than $(window)
or $(document)
):
$(function () {
$('input[name="showthis"]').hide();
//show it when the checkbox is clicked
$('input[name="checkbox"]').on('click', function () {
if ($(this).prop('checked')) {
$('input[name="showthis"]').fadeIn();
} else {
$('input[name="showthis"]').hide();
}
});
});