Note that there are some explanatory texts on larger screens.

plurals
  1. POI want loop in select box according radio button
    primarykey
    data
    text
    <p>I have task in which when I select 12 hour radio button then value of drop down change according to am and pm and if i am selecting 24 hours radio button then drop down value is 1 to 24. i am able to achive this task but now value of select box display throught loop. how can achive this.</p> <p>My code is: </p> <pre><code>&lt;select class="describe"&gt; &lt;option name="name" value="1"&gt;select type&lt;/option&gt; &lt;/select&gt; &lt;div&gt; &lt;input type="radio" id="class" name="type" value="1" checked&gt;12 hour &lt;br/&gt; &lt;input type="radio" id="Club" name="type" value="2" &gt;24 hour&lt;br/&gt; &lt;/div&gt; </code></pre> <p>jquery:</p> <pre><code>&lt;script&gt; var listA = [ { name: '1am', value: '1am' }, { name: '2am', value: '2am' }, { name: '3am', value: '3am' } ]; var listB = [ { name: '12', value: '12' }, { name: '13', value: '13' }, { name: '14', value: '14' } ]; $(document).ready(function () { $('#class').bind('click', function () { $('.describe').empty(); $.each(listA, function (index, value) { $('.describe').append( '&lt;option value="' + value.value + '"&gt;' + value.name + '&lt;/option&gt;' ); }); }); $('#Club').bind('click', function () { $('.describe').empty(); $.each(listB, function (index, value) { $('.describe').append( '&lt;option value="' + value.value + '"&gt;' + value.name + '&lt;/option&gt;' ); }); }); }); &lt;/script&gt; </code></pre> <p>loop for select code(which was tried by me):</p> <pre><code>$(document).ready(function () { $('.seconds').each(function () { for (var i = 00; i &lt;= 60; i++) { $('&lt;option /&gt;').val(i).html(' ' + i).appendTo($(this)); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    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