title: Javascript - If no radio buttons are selected, check the first one
body: <p>I'm a beginner in JavaScript. I have several radio buttons on my dynamic page and I want to create a script to make the following:</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>    &lt;input type="radio" id="elemainfoto"&gt;
      &lt;input type="radio" id="elemainfoto"&gt;
      &lt;input type="radio" id="elemainfoto"&gt;
  </code></pre>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>    var radio = '#elemainfoto',
      if(radd.value == 0) {
          radd.checked the first radio element,
      } else {
          keep the way it is,
      }
  </code></pre>
  
  <p>If none of the radio elements are marked, mark the first compulsory.</p>