title: How to get the NAME and value of a radio button when DYNAMICALLY selected - in jQuery?
body: <p>I have two groups of radio buttons here and I want to get the content of Name and Value attributes when they're dynamically selected. I did get the content of the value attribute but not the name attribute.
  Appreciate your help!
  Here's the code: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var var1 = "";
  
  function myFun(){
  $( "input[type=radio]:checked" ).each(function(){
   var1 = $(this).val();
   alert(var1);
  });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form&gt;
  &lt;h3&gt;Fruits&lt;/h3&gt;
    &lt;div&gt;
      &lt;input type="radio" name="fruit" value="orange" id="orange"&gt;
      &lt;label for="orange"&gt;orange&lt;/label&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;input type="radio" name="fruit" value="apple" id="apple"&gt;
      &lt;label for="apple"&gt;apple&lt;/label&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;input type="radio" name="fruit" value="banana" id="banana"&gt;
      &lt;label for="banana"&gt;banana&lt;/label&gt;
    &lt;/div&gt;
  
  &lt;h3&gt;Delivery&lt;/h3&gt;
      &lt;div&gt; 
      &lt;input type="radio" name="delivery" value="Y" id="y"&gt;
      &lt;label for="orange"&gt;Yes&lt;/label&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;input type="radio" name="delivery" value="N" id="n"&gt;
      &lt;label for="apple"&gt;No&lt;/label&gt;
    &lt;/div&gt;
  
    &lt;button onclick="myFun()"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>