이 코드는 IE가 아니라 FF에서 잘 작동합니다. 우리는 또한해야합니다jquery는 IE에서 작동하지 않습니다. FF로 잘 작동합니다.
<select id="targetSelectBox">
<!-- options to come -->
</select>
:
var target = $("#targetSelectBox")//;
이 선택 실제로 요소를 찾는되어 있는지 확인 :
var target = $("#targetSelectBox")
var vals = values.split(";");
for (var i = 0; i < vals.length; i++) {
var parts = vals[i].split(":");
target.append($('<option />').val(parts[0].trim()).text(parts[1].trim()));
}
이 왜 답변을 받아 않았다 여기 (http://stackoverflow.com/questions/2111859/jquery-populate-select-box-with-keyvalue-pair) 솔루션이 작동하지 않았다면? – Sampson
IE에서 작동했을 때 파이어 폭스와 잘 동작했습니다. 작동하지 않았습니다. – Shah