Reputation: 801
Using JQuery i'm performing Inline Edit and delete operations for textarea comment.Currently i'm able to Edit/update and delete data everything works fine but one small change in my requirement When i click on edit button i should get the value of label in textarea which i'm not able to achieve at the moment please someone help me out in achieving it Thanks!
JQUERY
$('#demoajax').on('click','.ajaxedit',function()
{
var edittrid = $(this).parent().parent().attr('id');
if(pre_tr_id)
{
return false;
}
pre_tr_id = true;
var tds = $('#'+edittrid).children('td');
var tdstr = '';
var td = '';
pre_tds = tds;
for(var j=0;j<field_arr.length;j++)
{
tdstr += "<td><textarea type='"+field_arr[j]+"' name='"+field_name[j]+"' value='"+$(tds[j]).html()+"' placeholder='"+field_pre_text[j]+"'></textarea></td>";
}
tdstr+="<td>"+updatebutton +" " + cancel+"</td>";
$('#createinput').remove();
$('#'+edittrid).html(tdstr);
});
Upvotes: 1
Views: 509
Reputation: 1544
Don't put value attribute with textarea. You will have to give textarea value as below :
tdstr += "<td><textarea type='"+field_arr[j]+"' name='"+field_name[j]+"' placeholder='"+field_pre_text[j]+"'>"+$(tds[j]).html()+"</textarea></td>";
Upvotes: 1