Friday, 8 January 2016
Jquery HTML Datatable click event Code
If you want to click on Student Id
jQuery Code:
$('#tblStdDetails').find('tr td:nth-child(1)').click(function (event) {
alert();
});
Here tblStdDetails is your table id
HTML CODE:
<table border="1" cellpadding="0" cellspacing="0" class="display cstblStdDetails" id="tblStdDetails">
<thead>
<tr>
<th>Student Id</th>
<th>Student Name</th>
<th>Branch</th>
<th>Address</th>
<th>Phone No</th>
</tr>
</thead>
<tbody>
<tr><td style="cursor: pointer; text-decoration: underline;">1</td><td>Anirudh</td><td>ECE</td><td>Chennai</td><td>9999999999</td></tr>
<tr><td style="cursor: pointer; text-decoration: underline;">2</td><td>Baskar</td><td>CSE</td><td>Hyderabad</td><td>9999999999</td>
</tr>
</tbody></table>
<table border="1" cellpadding="0" cellspacing="0" class="display cstblStdDetails" id="tblStdDetails">
<thead>
<tr>
<th>Student Id</th>
<th>Student Name</th>
<th>Branch</th>
<th>Address</th>
<th>Phone No</th>
</tr>
</thead>
<tbody>
<tr><td style="cursor: pointer; text-decoration: underline;">1</td><td>Anirudh</td><td>ECE</td><td>Chennai</td><td>9999999999</td></tr>
<tr><td style="cursor: pointer; text-decoration: underline;">2</td><td>Baskar</td><td>CSE</td><td>Hyderabad</td><td>9999999999</td>
</tr>
</tbody></table>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment