JQuery gets the table data sample code


Here is a table:

  Click delete to execute save, and the onclick event SaveItem(”< % # Eval (” ID ”) >” , this);

In JS


function SaveItem(id,btn)
{
var tbl = $(btn).parent().parent().parent();

//Table second row records

var dj = tbl.children().eq(1).chilren().eq(3).find("INPUT").attr("value") ; //The find method is supposed to return an array, but there's only one element. If there are more than one element, specify which one can be selected by using a selector in Jquery or by using an enumeration: find("INPUT").each(function(I){

//alert($(this).attr("value"));

// The assignment

$(this).attr("value","YOUR_VALUE");

})
var content=tbl.children().eq(2).children().eq(1).find("TEXTAREA").text();//This is looking for the contents of the question text box in the third row, third column. If you use ASP.NET's ASP.NET TextBox control in multi-line mode where the TagName is' TEXTAREA', use the attr("value") method or use the text() method to get the value.

var mark = tbl.children().eq(3).children().eq(1).find("INPUT").attr("value");//Gets the score textbox value for the fourth row and third column.

}