Accessing the radio button value
<p>Html Code: -</p>

<pre><code>&lt;input type="radio" name="radio" id="radio" value="1" onclick="validate()"&gt; For Yourself&lt;/input&gt; &lt;/p&gt;&lt;/br&gt;
    &lt;p&gt;
    &lt;input type="radio" name="radio" id="radio" value="2" onclick="validate()"&gt; For Users&lt;/input&gt;
    &lt;/p&gt;
</code></pre>

<p>And JavaScript Code : -</p>

<pre><code>function validate()
    {
        var btn_value=document.getElementById("radio").value;
        if(btn_value==true)
        {
            alert(btn_value);
        }

    }
</code></pre>

<p>Now, whenever I am trying to print the value of radio button. It is always printing value as 1. </p>

<p>So, Now I don't understand what exactly am I missing here...</p>

<p>Thanx in advance for your help.</p>
