1

I am writing an canJS application and so far successful in handling the click event for an html table. Using the following code.

 'table td click':function(el,event){
        console.log('clicked ',el.text());
     }
  1. How to listen to only first column click for the table instead of whole td?
  2. How to retrieve particular column's data from the td (el)?
ramblinjan
  • 6,578
  • 3
  • 30
  • 38
Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22

1 Answers1

2

Try this:

'table td:nth-child(1) click'

Possible answer of 2nd question, first handle whole tr:

'table tr:nth-child(1) click':function(el,event){
    console.log(el.find('td').eq(0).html()); // gets first column
 }
karaxuna
  • 26,752
  • 13
  • 82
  • 117