Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show value of selected dynamically created radiobutton in a div using jquery
    primarykey
    data
    text
    <p>please help me to display the value of selected dynamically created radiobutton into a div </p> <p>heres my code...Please tell me whats gone wrong in my code... Thanks</p> <pre><code>&lt;script type="text/javascript"&gt; var div = $("#show_ans"); $("input[type='radio']").click(function() { var radioVal = $(this).value; div.html("radioVal"); }); &lt;/script&gt; </code></pre> <p>And the html code is </p> <pre><code>$i=0 $sql = mysql_query("SELECT * FROM `question_bank` where `test_name`='$tname' AND`posted_by`='$fac'"); if (mysql_num_rows($sql) &gt; 0) while($row2 = mysql_fetch_array($sql)) { if($i&lt;=$maxq){ .... .... &lt;table&gt; &lt;tr&gt;&lt;td colspan=3&gt;&lt;?php echo $row2['question'];?&gt;&lt;/td&gt; &lt;td&gt;&lt;ul class="menu"&gt; &lt;li&gt;&lt;div id="show_ans" style="display:none"&gt;&lt;/div&gt; &lt;/li&gt;&lt;/ul&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td style="width:250px" align=left&gt; &lt;input id="r1" type="radio" name="&lt;?php echo "s_option".$i;?&gt;" value="&lt;?php echo $row2['choice_a'];?&gt;" &gt;&lt;?php echo $row2['choice_a'];?&gt; &lt;/td&gt; &lt;td style="width:250px" align=left&gt; &lt;input id="r1" type="radio" name="&lt;?php echo "s_option".$i;?&gt;" value="&lt;?php echo $row2['choice_b'];?&gt;" &gt;&lt;?php echo $row2['choice_b'];?&gt; &lt;/td&gt; &lt;td style="width:250px" align=left&gt; &lt;input id="r1" type="radio" name="&lt;?php echo "s_option".$i;?&gt;" value="&lt;?php echo $row2['choice_c'];?&gt;" &gt;&lt;?php echo $row2['choice_c'];?&gt; &lt;/td&gt; &lt;td style="width:250px" align=left&gt; &lt;input id="r1" type="radio" name="&lt;?php echo "s_option".$i;?&gt;" value="&lt;?php echo $row2['choice_d'];?&gt;" &gt;&lt;?php echo $row2['choice_d'];?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; .... .... </code></pre> <p>If any clicks on the radio button it should produce the value on corresponding div and it shall be repeated for all the loop repeats. please guide me thanks in advance.</p>
    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.
 

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