title: jQuery if condition for radio button name and value
body: <p>I have a radio button like</p>
  
  <pre><code>&lt;input type="radio" name="user-type" value="Store"&gt;
  &lt;input type="radio" name="user-type" value="Brand"&gt;
  </code></pre>
  
  <p>I tried writing jQuery script like</p>
  
  <pre><code>if($("input[name=user-type]:checked").val()) == "Brand"){
       $(".showstore").hide();
       $(".showbrand").show();
  }
  </code></pre>
  
  <p>and also tried</p>
  
  <pre><code>if($("input[name=user-type]:checked").val()) == "Brand").click(function(){
         $(".showstore").hide();
       $(".showbrand").show();
  });
  </code></pre>
  
  <p>and also tried</p>
  
  <pre><code>if ( $("input[name=user-type]:radio").val() == "Brand"){
       $(".showstore").hide();
       $(".showbrand").show();
  }
  </code></pre>
  
  <p>None of these worked, any correction is appreciated. Thanks.</p>
  
  <p><strong>Update1</strong></p>
  
  <p>I tried in this way and this hide both</p>
  
  <pre><code>if($("input[name=user-type]:checked").val() == "Brand"){
       $(".showstore").hide();
       $(".showbrand").show();
  }
  else if($("input[name=user-type]:checked").val() == "Store"){
       $(".showstore").show();
       $(".showbrand").hide();
  }
  </code></pre>