javascript - get the value from a particular column -


i'm trying alert message on click each column. have table in 3 row , 4 column, want alert message next column value on third column click of each table. have tried column value not particular column. problem invoke in every column click want alert mesage when third column click of each row

html

<table id='mytable'> <tr><td>r1c1</td><td>r1c2</td><td>r1c3</td><td>r1c4</td></tr> <tr><td>r2c1</td><td>r2c2</td><td>r2c3</td><td>r2c4</td></tr> <tr><td>r3c1</td><td>r3c2</td><td>r3c3</td><td>r3c4</td></tr> </table> 

js

$("#mytable tr").bind("click", function () {      alert($(this).children("td").eq(3).html()); }); 

demo here

try this

 $('table#mytable tr td:nth-child(3)').on('click', function() {             alert($(this).next().html());         }); 

check here


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -