Here is the markups i have used
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr class="tr-head">
<th>Amount Owed</th>
<th>Amount Paid</th>
<th>Check / Cash / Online</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="row0">
<td>$10 <input type="text" name="amount_owed" id="amount_owed" value="10" style="display: none; width: 40px;" /></td>
<td>$20 <input type="text" name="amount_paid" id="amount_paid" value="20" style="display: none; width: 40px;" /></td>
<td>$30 <input type="text" name="check_cash_online" id="check_cash_online" value="30" style="display: none; width: 40px;" /></td>
<td><a href="javascript:void(0);" class="edit-row" title="row0">Edit</a></td>
</tr>
<tr class="row1">
<td>$10 <input type="text" name="amount_owed" id="amount_owed" value="10" style="display: none; width: 40px;" /></td>
<td>$20 <input type="text" name="amount_paid" id="amount_paid" value="20" style="display: none; width: 40px;" /></td>
<td>$30 <input type="text" name="check_cash_online" id="check_cash_online" value="30" style="display: none; width: 40px;" /></td>
<td><a href="javascript:void(0);" class="edit-row" title="row1">Edit</a></td>
</tr>
</tbody>
</table>
I want to remove first three child cell td text (i.e. $10, $20….) except input element when i click on Edit of particular row. Input type should be show After hiding text of cell. Please help me how can i make it using jquery script. thanks
I have tried some script to do this i.e.
$(document).ready(function(){
$('.edit-row').click(function(){
var title = $(this).attr('title');
$('.'+title+' td').text('');
});
});
But above script making cell empty.
This code will work for you:
Tested here.
Zachary Kniebel hit it with the .contents() method
Sorry, I forgot the part where the input elements are shown:
Tested and working.