On my website there is a situation where I need to append new tags to a specific selection box. I am doing the following:
1.Make an ajax request which returns option tags like
etc.,
2.Set the inner html of a specific selection box by
document.getElementById("id").innerHTML=response;
it works well in firefox/chrome but not in IE....
any known solution for this..??
回答1:
It's a known IE bug. You can either user DOM methods to append/replace the option elements, or you can use the workarounds suggested by Microsoft, one of which is to wrap your select in a div and set the div's innerHTML to "
It's a known issue in IE. Sorry for wasting everyone's time, long story short options.innerHTML is buggy. The work around Microsoft suggest is wrapping your tag in a tag. Then you can use the div.innerHTML to change the code.