Jquery
how select those rows loaded in table .
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Karthikeyan KRank #554 · 4.4K reputationPosted Sep 9, 2015, 2:58 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Sep 9, 2015, 3:36 AM EDT
<%@ 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>
Raja TRank #685 · 3.5K reputationPosted Sep 9, 2015, 4:02 AM EDT