jquery
how select those rows loaded in table .
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raja TPosted Sep 9, 2015, 8:02 AM
Upendra Pratap ShahiPosted Sep 9, 2015, 7:36 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BindImageDropdown.aspx.cs" Inherits="BindImageDropdown" %>
DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>title>
<style type="text/css">
table tbody tr:hover {
background-color: orange;
cursor: pointer;
}
style>
<script src="http://code.jquery.com/jquery-1.10.2.js">script>
<script type="text/javascript">
$(document).ready(function () {
$('table tbody tr').click(function () {
//alert($(this).text());
alert(getTableData($('#tstTable')));
});
});
function getTableData(table) {
var data = [];
table.find('tr').each(function (rowIndex, r) {
var cols = [];
$(this).find('th,td').each(function (colIndex, c) {
cols.push(c.textContent);
});
data.push(cols);
});
return data;
}
script>
head>
<body>
<form id="form1" runat="server">
<div>
<table id="tstTable" class="tbl">
<caption>Version History Tablecaption>
<thead>
<tr>
<th>Change Dateth>
<th>Change Typeth>
<th>Descriptionth>
<th>StaffIDth>
tr>
thead>
<tbody>
<tr>
<td>16/04/2010 07:30td>
<td>Edittd>
<td>New roletd>
<td>00215td>
tr>
<tr>
<td>15/02/2012 14:37td>
<td>Edittd>
<td>Out of stocktd>
<td>85487td>
tr>
<tr>
<td>14/03/2013 10:18td>
<td>Addtd>
<td>Out of datetd>
<td>15748td>
tr>
tbody>
table>
div>
form>
body>
html>
Karthikeyan KPosted Sep 9, 2015, 6:58 AM