Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35289

Insert new row with button - Buttons jQuery on-click fails

$
0
0

So I have a DataTable on a page with a button that will insert a new row when clicked. One of the columns contains a link that should simply alert something, however... it doesnt do anything at all.

Heres the jQuery

$(document).ready(function() {

    var clients_table = $('#add_clients').DataTable();

    $('#addRow').on( 'click', function () {

        clients_table.row.add( [
            '<input type="text" class="hostname" name="hostname[]">',
            '<input type="text" class="IP" name="ip[]">',
            '<select name="deploy_method[]"><option value="YUM" selected="selected">Yum</option><option value="cfengine">CFengine</option></select>',
            '<a href="#" class="deleteRow">Remove</a>'
        ] ).draw();
    } );

    $('.deleteRow').on( 'click', function () {
        alert('test');
    });
} );

Viewing all articles
Browse latest Browse all 35289

Trending Articles