Sara
Sara

Reputation: 14638

remove disable from input - using jQuery

I have a table like following,'

<table id="online_seat">
     <tbody id="row_B" class="selected">
        <tr class="seat_01 B selected">
           <td>B1</td>
           <td>
             <input id="status_01B" type="text" disabled="disabled">
          </td>
       </tr>
     <tr class="seat_02 B selected">
         <td>B2</td>
         <td>
          <input id="status_02B" type="text" disabled="disabled">
        </td>
     </tr>
   </tbody>
 </table>

What I want is I want to remove disabled from every input on page load if the <tr> has a class selected.

Upvotes: 1

Views: 989

Answers (2)

dfsq
dfsq

Reputation: 193301

Another variant that should work:

$(function() {
    $('tr.selected input:disabled').attr('disabled', false);        
});

Upvotes: 1

Samich
Samich

Reputation: 30175

$('tr.selected input[disabled="disabled"]').removeAttr('disabled');

Code: http://jsfiddle.net/bVu5w/

Upvotes: 4

Related Questions