I want to fill the value of the rows of a table into textboxes by clicking a button. this is what I have done
<table id="tbl_Features" class="col-md-12 table table-bordered table-hover table-condensed table-responsive">
<thead>
<tr>
<th>
Name
</th>
<th>
Value
</th>
<th>
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr >
<td id="displayName@{@item.Id}">
@item.DisplayName
</td>
<td id="Value@{@item.Id}">
@item.Value
</td>
<th>
<div class="dropdown">
<button class="btn bg-blue dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Operation
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a href="#" onclick="FillFeaturetoEdit(@item.Id)" class="dropdown-item">edit</a>
</div>
</div>
</th>
</tr>
}
</tbody>
</table>
This is the jquery for that
function FillFeaturetoEdit(id){
debugger;
var row = $("#displayName"+id);
var valueItem= row.text();
$("#txtDisplayName").val(valueItem);
row = $("#Value"+id);
valueItem= row.text();
$("#txtValue").val(valueItem);
}
but anytime I click the edit button although the row.text() and ValueItem show the right value but inputs(txtDisplayName and txtValue) value are empty