I'm trying to auto select the option in select by jquery after fetching the option value that needs to be selected. However it is not working in Chrome. Its working in firefox and IE 9. Why is it so ? function fill is the one that fills in the values. (function res, only resets the values filled by function fill and is not important for this question)
function fill(thisValue) { $('#inputString').val(thisValue); $.post("get.php?op=category", {queryString: ""+thisValue+""}, function(data){ if(data.length >0) { $("#mymenu option[value='"+data+"']").attr('selected', 'selected'); $('#mymenu').attr("disabled","disabled"); } }); $.post("get.php?op=name", {queryString: ""+thisValue+""}, function(data){ if(data.length >0) { $('#nameString').val(data); $('#nameString').attr("disabled","disabled"); } }); $.post("get.php?op=author", {queryString: ""+thisValue+""}, function(data){ if(data.length >0) { $('#authorString').val(data); $('#authorString').attr("disabled","disabled"); } }); $.post("get.php?op=publisher", {queryString: ""+thisValue+""}, function(data){ if(data.length >0) { $('#publisherString').val(data); $('#publisherString').attr("disabled","disabled"); } }); setTimeout("$('#suggestions').hide();", 200); } function res(inputString) { $('#publisherString').attr("disabled", false); $('#publisherString').val(''); $('#nameString').attr("disabled",false); $('#nameString').val(''); $('#authorString').attr("disabled",false); $('#authorString').val(''); $('#mymenu').attr("disabled",false); $('#mymenu option').attr('selected', false); }