i have a problem when change page, data append can't remove
for example : i append with javascript in init page
$$(document).on('click', '#btnappend', function (e) {
var table = '<table id="barang_detail" class="tabel-detail" cellspacing="0">'+
'<tr><td style="width:8px;">Barang</td><td id="det_nama">'+$$(this).attr('data-nama_barang')+'</td></tr>'+
'<tr><td>Harga</td><td id="det_harga">'+$$(this).attr('data-harga')+'</td></tr>';
$$('#div_append').append(table);
});
When I switch pages, and back again.
and do append again by click button.
then div append element have duplicate data
like cache append not refresh element
how to fix it ?
Before append table, empty his container :
$$('#div_append').empty()
or $$('#div_append').html('')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.