Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use this it's works for me</p> <pre><code> &lt;script&gt; function test() { var home= $('input:radio[name=home-location]:checked').val(); document.getElementById("h1").innerHTML=home; var preferred= $('input:radio[name=home-preferred]:checked').val(); document.getElementById("h2").innerHTML=preferred; return false; } &lt;/script&gt; &lt;form onsubmit="return test();"&gt; &lt;div id="form_block"&gt; &lt;div class="home-location"&gt; &lt;ul&gt; &lt;li&gt;Home Location&lt;/li&gt; &lt;li&gt; &lt;input type="radio" name="home-location" value="india" class="radio" id="home-india" /&gt;&lt;label for="home-india"&gt;India&lt;/label&gt;&lt;/li&gt; &lt;li&gt; &lt;input type="radio" name="home-location" value="usa" class="radio" id="home-usa" /&gt;&lt;label for="home-usa"&gt;USA&lt;/label&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="prefer-location"&gt; &lt;ul&gt; &lt;li&gt;Preferred Location&lt;/li&gt; &lt;li&gt; &lt;input type="radio" name="home-preferred" value="india" class="radio" id="preferred-india" /&gt;&lt;label for="preferred-india"&gt;India&lt;/label&gt;&lt;/li&gt; &lt;li&gt; &lt;input type="radio" name="home-preferred" value="usa" class="radio" id="preferred-usa" /&gt;&lt;label for="preferred-usa"&gt;USA&lt;/label&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="result"&gt; My Home Location is: &lt;span class="home-location-result" id="h1"&gt;&lt;/span&gt;and my preferred location is: &lt;span class="home-location-result" id='h2'&gt;&lt;/span&gt; &lt;/div&gt; &lt;input type="submit" value="Populate Values" id="ss" class="submit" /&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload