简体   繁体   中英

Jquery Change text of a button on click in a table

I need to change button text from mark completed to completed in a table for a selected row below is the code I am using but does not set the value to completed .

$('table :button').click(function(){
    $(this).closest('tr').find('button').attr('val' , 'Completed');
});

There is no attribute called val . Use text() method like following.

$('table :button').click(function(){
    $(this).text('Completed');
});

Try the direct approach:

$('table :button').click(function(){
 $(this).val('Completed');
});

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM