Home > Web Front-end > JS Tutorial > body text

JQuery Get Table Data Sample Code_jquery

WBOY
Release: 2016-05-16 16:46:56
Original
1403 people have browsed it

There is such a form:

JQuery Get Table Data Sample Code_jquery
Click to delete to save, you need to execute the onclick event SaveItem("<%#Eval("ID")>",this);

In JS

Copy code The code is as follows:

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

//table second row record

var dj = tbl .children().eq(1).chilren().eq(3).find("INPUT").attr("value"); //The find method originally returns an array, but here there is only one element, so it can be Write. If there are multiple elements, to specifically determine an element, you can confirm the selection through the selector used by Jquery or use an enumeration: find("INPUT").each(function(i){

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

//Assignment

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

})
var content=tbl.children().eq(2).children().eq(1).find("TEXTAREA").text();//What we are looking for here is the third line The content of the test question text box in the third column. If you use the ASP.NET TextBox control of ASP.NET and it is in multi-line mode, TagName here is 'TEXTAREA', use the attr("value") method or directly use the text() method to get the value.

var mark = tbl.children().eq(3).children().eq(1).find("INPUT").attr("value");//Get the fourth line here The score text box value in the third column.

}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template