JQuery gets the table data sample code

  • 2020-03-30 03:07:12
  • OfStack

Here is a table:

< img SRC = "border = 0 / / files.jb51.net/file_images/article/201405/201405261708122.gif? 201442617827 ">  
Click delete to execute save, and the onclick event SaveItem("< % # Eval (" ID ") >" , this);

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){


// The assignment  


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.


Related articles: