title: how to check if input type is radio using jquery
body: <p>I want to handle html elements differently based on their type.</p>
  
  <p>Using jquery, how do I check to see if an input type is a radio button?</p>
  
  <p>I've tried:</p>
  
  <pre><code>if ($('#myElement').is(':radio')) {
      ....//code here
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if ($('#myElement').is("input[type='radio']")) {
      ....//code here
  }
  </code></pre>
  
  <p>Neither of these worked. Any ideas?</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <pre><code>if ($('#myElement').is(':radio')) {
      ....//code here
  }
  </code></pre>
  
  <p>works, but my radio buttons don't have the id attribute, they only have a name attribute, which is why it did not work.</p>
  
  <p>I changed my code to: </p>
  
  <pre><code>if ($('input[name=' + myElement + ']').is(":radio")) {
      ....//code here
  }
  </code></pre>