javascript - multiselect box will not populate without alert -


i can't post code try important pieces in here. problem have populate multiselect box database selected items , add selected attribute. works in ie 7 testers using, unfortunately i'm on ie 9 , of users on ie 9. code doesn't work on ie 9 or on firefox. weird thing work if stick alert after call function populates multiselect.

after getting selected values database through ajax call use

var oldvalues.push($(this).find("value_id).text());      

i alert of oldvalues there 31,32,45 use $("drop2-input").val(oldvalues);

if put alert after line works.

i have spent majority of day checking every line of code there no missing semicolons, no curly brackets out of place, , no parentheses out of place. know of way make work. oh tried using timeout pause code stoped rest of page loading.

this should work you.

take @ jsfiddle put togethre you: http://jsfiddle.net/douglasloyo/netjd/

    var json = [         {name:"texas", value:1},         {name:"texas again", value:2},         {name:"texas rocks!", value:3}];      $.each(json, function(i, value) {         $('#my-select').append($('<option>').text(value.name).attr('value', value.value));     });      <select id="my-select">         <option>-select-</option>     </select> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -