テーブルに行があり、css スタイルが に設定されているため、その行が表示されませんdisplay:none
。
HTML テーブル:
<table class="myTable">
<tr class="prototype">
........
</tr>
</table>
CSS コード:
.myTable .prototype{display:none;}
今、私は同じ行を複製し、それにいくつかのデータを追加し、以下のように行をテーブルに追加する必要があります:私は以下のjqueryコードを持っています:
var master = $(this).parents("table.myTable");
var prot = master.find(".prototype").clone();
prot.attr("class", "");
prot.find("#attributeValue").attr("value", "ABC");
prot.find("#contactFirstName").attr("value", "XYZ");
jQuery('table.myTable tr:last').before(prot);
ただし、行はテーブルに追加されません。私を助けてください。
ありがとう!