IEとFFでreplaceWithの動きがアレだよー
selectを変更したらajaxで中身入れ替えるよ、というおなじみの処理。
- ベースのhtmlはこんな感じ
<select id="manager-type"> <option value="hoge">名誉顧問</option> <option value="moge">終身監督</option> </select> <div id="comment">ここに内容</div>
- 普通に書いたら
$("#manager-type").change(function(){ $.ajax({ url: "http://urldesu.jp", cache: false, success: function(result){ $("#comment").replaceWith(result); } });
こんな感じだと思うのですが、MacのFFで作業してたらサクサク動いていたのに、IEだと中身が全部帰ってこない…。
- 結果
$("#manager-type").change(function(){ $.ajax({ url: "http://urldesu.jp", cache: false, success: function(result){ if(jQuery.browser.mozila) { $("#comment").replaceWith(result); } else { $("#comment").empty().html(result); } } });
こうなりました。何がいけないのかねぇ。