I've a table that contains 3 columns. I need to bind an event that fires off whenever one of those columns is clicked using jQuery.
However, I need to know the index of the column clicked.
i.e: First column (index 0), Second column (index 1), Third column (index 2), and so on...
How can I do that?
var firstRow:
var firstRow = $("tr:first > th", "table[id*=Grid]");
Take a look:
firstrow.click(function(e){
//var id = e.target.index;
var id = $(e).parent().children().index(this);//returns -1
})