onClick get row values from Html table
How can You get table cell values
and cells text boxes values?That means getting childNodes values using
java script.This is easy using core javascripts.
Returns a nice array of your data, then you can display it how you want.
function updateRowData(id) {
if(confirm("Are you sure you want to update this row?")) {
// alert(id);
$("tr#table-row-"+id).click(function() {
//var tableData = $("tr#table-row-"+id).children("td").map(function() { // you can use this also but you need to comment upper line ( $("tr#table-row-"+id).click(function() { ) and uncomment this line
var tableRow = $(this).children("td").map(function() {
return $(this).text();
}).get();
alert("Your data is: " + $.trim(tableRow[0]) + " , " + $.trim(tableRow[1]) + " , " + $.trim(tableRow[2]));
});
}
}
Returns a nice array of your data, then you can display it how you want.
function updateRowData(id) {
if(confirm("Are you sure you want to update this row?")) {
// alert(id);
$("tr#table-row-"+id).click(function() {
//var tableData = $("tr#table-row-"+id).children("td").map(function() { // you can use this also but you need to comment upper line ( $("tr#table-row-"+id).click(function() { ) and uncomment this line
var tableRow = $(this).children("td").map(function() {
return $(this).text();
}).get();
alert("Your data is: " + $.trim(tableRow[0]) + " , " + $.trim(tableRow[1]) + " , " + $.trim(tableRow[2]));
});
}
}
1 comments
Great self learning books to become an expert in PHP...
php development melbourne