How to change enable to disable in Td?

I have a question. I Have a table data

as like this

<table>
    <tr>
        <td>Enabled</td>
        <td><button class="js-enabled">Desabled</button></td>
    </tr>
     <tr>
         <td>Desabled</td>
         <td><button class="js-enabled">Enabled</button></td>
    </tr>
     <tr>
        <td>Enabled</td>
        <td><button class="js-enabled">Desabled</button></td>
    </tr>
     <tr>
         <td>Desabled</td>
         <td><button class="js-enabled">Enabled</button></td>
    </tr>
     <tr>
        <td>Enabled</td>
        <td><button class="js-enabled">Desabled</button></td>
    </tr>
     <tr>
         <td>Desabled</td>
         <td><button class="js-enabled">Enabled</button></td>
    </tr>
</table>

and I used to this jquery function

$('.js-enabled').click(function(){
            $(this).replaceWith('<button class="btn btn-success">Active</button>');     
            }); 

Now i want to

  1. if i click enable Button than change Enabled To Disabled Left and Right Both side

Link

Answers


For the sake of the answer I'll use your code, but just to let you know, it's spelled 'Disabled'.

$('.js-enabled').click(function(){
    var button = $(this);
    var label = $(this).parent().prev('td');

    button.text() == 'Desabled' ? button.text('Enabled') : button.text('Desabled');
    label.text() == 'Desabled' ? label.text('Enabled') : label.text('Desabled');
}); 

http://jsfiddle.net/EGDZE/2/


Need Your Help

Read and write to Excel in c#

c# excel oledb

I am creating a test framework that should read parameters from an excel sheet. I would like to be able to :