Examples are as follows:
Not much to say, directly on the code.
$ ("Table TR"). Click (function () {//For table row Add click event
var tr = $ (this);/Find TR primary color
var td = Tr.find ("TD");//Find TD element
alert (td[0].innerhtml);//Specify subscript can
})
Today's project needs to use the table selected columns of data, online data found can not get to select the specified column of data, after analyzing the test to summarize the above code, you can get the selected row/column data. The data for TD is not. Val (), nor. html (). After a number of tests to find out that it is through innerHTML () to obtain content, hoping to help the needy friends.
Above this jquery gets table specifies rows and columns of data methods (currently selected row, column) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.