Click here to Skip to main content
15,888,048 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi There, can some one help how to dynamically add a text to a column and then add Html (break) then add next few line, each paragraph in a column before (break) has to create action link dynamically, if you look at my below table structure, i have to add dynamic lines with
in the last colum and then follows action link next last column.
Java
function Test(){
  var i = 0;
  var t = document.getElementById('Applicant_Table');
  $("#Applicant_Table tr").each(function () {
    var val1 = $(t.rows[i].cells[0]).text();
    if (val1 == _Appcnt_id)
      i++;
    });
}

@foreach (var item in Model) {
@Html.DisplayFor(modelItem => item.applicant_id)
@Html.CheckBox("Applicant", new { id=item.applicant_id})
@Html.DisplayFor(modelItem => item.name)
@Html.DisplayFor(modelItem => item.phone)
@Html.DisplayFor(modelItem => item.physical_address)
@Html.ValueFor(modelItem => item.date_entered, "{0:dd/MM/yyyy}")
------

What I have tried:

JavaScript
$(t.rows[i].cells[6]).text()=test
Posted
Updated 12-Aug-17 20:03pm
v2

1 solution

You used the wrong text() version...
In jQuery methods are behave - mostly - in a unified way... The version with no parameter will return the current value (text() will return the current text value of the selected elements), while the version with parameters will set the new value (text('me') will set value of text to 'me' for selected elements)...
So you have to use the right one, here...
.text() | jQuery API Documentation[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900