除了这样,有没有更好的办法:
$("#mainTable tbody").on('click',"tr", function () {
console.log($(this).children().eq(1).text());
} );
在网上看到这种写法,但是是不行的
$('#mainTable tbody').on('click','tr td:nth-child(3)', function (e) {
var name = $(this).text();
alert(name);
} );
你在生产table的时候 给列生成一个指定的标识不就行了。