title: How to validate gender in jquery
body: <p>this is my html</p>
  
  <pre><code>&lt;p&gt;&lt;span&gt;Male&lt;/span&gt; &lt;input type="radio" class="gender" value="male"&gt;
           &lt;span&gt;Female&lt;/span&gt; &lt;input type="radio"  class="gender" value="female" &gt;
          &lt;div id="dis"&gt;&lt;/div&gt;
          &lt;/p&gt;
  </code></pre>
  
  <p>and this is jquery code</p>
  
  <pre><code>var gender = $('.gender').val();
      if ($(".gender:checked").length &gt; 1 || $(".gender:checked").length == 0){
        $('#dis').slideDown().html('&lt;span id="error"&gt;Please choose a gender&lt;/span&gt;');
      }
      else{
        alert(gender)
      }
  </code></pre>