jquery - Append options to drop down box? -


i'm working on project want put drop down box , input text field in same td tag. here current code:

<td >     <label class="avbhide">     <select id="test" name="test">         <option value="">--select user--</option>     </select>     <input type="text" name="" id="block" class="email" value=""  placeholder="example@gmail.com" title="enter email please."/>     </label>                                 </td> 

jquery code use populate dropdown box:

var studvalues = [];  studvalues.push({'idone':"13",'idtwo':"mike, pears"});  studvalues.push({'idone':"16",'idtwo':"steven, reed"});  studvalues.push({'idone':"14",'idtwo':"john, cook"});   for(var i=0; < studvalues.length; i++){     $('#test').append('<option value='+studvalues[i].idone+'>'+studvalues[i].idtwo+'</option>'); } 

so tried use code , drop down never populated. created select tag outside of td tag , drop down populated. i'm confused, why not work current code when place select inside of td have text field. there rule have put them in separate tag? in case have put them in same td tag.

i tried on jsfiddle: https://jsfiddle.net/nrx02nwg/

it should $ instead $j, don't think?

for(var i=0; < studvalues.length; i++){     $('#test').append('<option value='+studvalues[i].idone+'>'+studvalues[i].idtwo+'</option>'); } 

Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -