addrow示例中只有JavaScript代码,调用失败
addrow示例中只有JavaScript代码,调用失败
qq123
Posts: 1Questions: 1Answers: 0
html中的添加按钮怎么写呢? <input type="button" value="添加" onclick="addRow()" />
$(document).ready(function() { var t = $('#example').DataTable(); var counter = 1; $('#addRow').on( 'click', function () { t.row.add( [ counter +'.1', counter +'.2', counter +'.3', counter +'.4', counter +'.5', counter +'.6', counter +'.7', ] ).draw( false ); counter++; } ); // Automatically add a first row of data $('#addRow').click(); } );This discussion has been closed.