Ho un problema con un javascript che verifica se i campi di un form sono compilati. con un input funziona mentre con un altro input con checkbox non va. Cosa sbaglio?
Grazie

Questo funziona
codice:
<div class="controls">
                                            <input class="span12" type="text" id="name" name="name" placeholder="* Nome-Cognome" />
                                            <div class="error left-align" id="err-name">Inserire nome.</div>
                                        </div>




 var name = $('input#name').val(); // get the value of the input field
        var error = false;
        if (name == "" || name == " ") {
            $('#err-name').show(500);
            $('#err-name').delay(4000);
            $('#err-name').animate({
                height: 'toggle'
            }, 500, function () {
                // Animation complete.
            });
            error = true; // change the error state to true
        }
Questo invece no
codice:
  <div class="controls">

    <input style="margin-top: 0px" type="checkbox" id="privacy"  name="privacy" value="Privacy Accettata" class="required">
    <label style="color: black; display: inline"> Autorizzo … </label> <div class="error left-align" id="err-privacy">Accettare privacy.</div>

  </div>






var privacy = $('input#privacy').val(); // get the value of the input field
        var error = false;
        if (privacy == "" || privacy == " ") {
            $('#err-privacy').show(500);
            $('#err-privacy').delay(4000);
            $('#err-privacy').animate({
                height: 'toggle'
            }, 500, function () {
                // Animation complete.
            });
            error = true; // change the error state to true
        }