title: how to get the values from fieldset using javascript?
body: <pre class="lang-html prettyprint-override"><code>&lt;form action=&quot;welcome.php&quot; method=&quot;post&quot; onsubmit=&quot;return validate();&quot;&gt;
  &lt;fieldset&gt;
  &lt;legend&gt; &lt;b&gt;Personal Info&lt;/b&gt; &lt;/legend&gt;
  &lt;pre&gt;
  &lt;b&gt;First Name&lt;/b&gt; &lt;input type=&quot;text&quot; id=&quot;fname&quot; size=&quot;30&quot;&gt;
  &lt;b&gt;Last Name&lt;/b&gt; &lt;input type=&quot;text&quot; id=&quot;lname&quot; size=&quot;30&quot;&gt;
  &lt;b&gt;Phone Number&lt;/b&gt; &lt;input type=&quot;number&quot; id=&quot;fn&quot; size=&quot;30&quot;&gt;
      &lt;fieldset&gt;
      &lt;legend&gt; &lt;b&gt;Gender&lt;/b&gt; &lt;/legend&gt;
      &lt;input type=&quot;radio&quot; id=&quot;male&quot; name=&quot;gender&quot; value=&quot;Male&quot;&gt;Male
      &lt;input type=&quot;radio&quot; id=&quot;female&quot; name=&quot;gender&quot; value=&quot;Female&quot;&gt;Female
      &lt;/fieldset&gt;
  &lt;/pre&gt;
  &lt;/fieldset&gt;
  &lt;input type=&quot;button&quot; value=&quot;submit&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  <p>JavaScript function is validate(). If First name or Last name or Gender is empty, user will see a message and form will not submit. By using JavaScript function what will be the solution?</p>