Tuesday, December 18, 2012

How to get HTML Table cell value on click event?

In some of the cases we want to access the value of HTML table cell value when we click on particular cell, this can be simply done using client side code only.

Here I am giving simple code to access HTML table cell value.

 <script type="text/javascript">
        $(document).ready(function () {
            $('table[id$=TableName] tr>td').click(function () {

This is JavaScript code; here I have used JQuery to get value. Here first I have integrated one function with table cell. This function will be executed when

we will click on cell. To get cell value I have written this line of code-


This alert() will display value of cell.


No comments:

Post a Comment