私は次のコードを持っています:-
//-- function to enable editing of content if disabled for new records --\\
function edit(e,elems)
{
if ( e.value == "new" )
{
$(e).parent().parent().find(":input[readonly]").each(function(index) {
$(this).prop('readonly',false);
$(this).addClass('highlight');
});
$(e).parent().parent().find("select[disabled]").each(function(index) {
$(this).prop('disabled',false);
$(this).addClass('highlight');
//-- Insert dynamic options --\\
if ($(this).attr('name') == 'low')
{
var optVal = "option[value='" + $(this).val() + "']";
var optclone = $("#affoptions").clone();
$(optclone).find(optVal).attr("selected",true);
$(this).html($(optclone).find("option"));
}
if ($(this).attr('name') == 'high')
{
var optVal = "option[value='" + $(this).val() + "']";
optclone = $("#insoptions").clone();
$(optclone).find(optVal).attr("selected",true);
$(this).html($(optclone).find("option"));
}
});
$(e).parent().parent().find(elems).focus();
} else {
$(e).parent().parent().find(elems).each(function(index) {
if ( $(this).is('select') )
{
$(this).prop('disabled',true);
} else {
$(this).prop('readonly',true);
}
$(this).removeClass('highlight');
});
}
}
Google Chrome では問題なく動作しますが、IE 8 では動作しません。基本的に、ラジオ ボタンのあるフォームがあり、そのうちの 1 つは新しいエントリ用です。これにより、基本的にテキスト入力フィールドが有効になり、選択フィールドの無効フラグが削除されます。無効にすると、選択オプションには値が 1 つしかありません。ラジオ ボタンは、非表示の div から使用可能なすべてのオプションを挿入し、新しいオプションで選択したインデックス値をマークして、初期ロードからの単一のエントリと一致させます。
IE では、選択オプションは完全に消去され、最初のエントリでさえ何も残されません。
これを適切に機能させることができず、複製された要素に問題があると想定しています。
私は何を間違っていますか?
ありがとうクレイグ