checkbox

by Akram kamal

HTML

<input type="checkbox" name="checkbox" id="checkbox" value="scheckbox" />
<br />
<input id="showthis" name="showthis" size="50" type="text" value="text here" />

JavaScript

$(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();
            }
        });
    });