Click a Cell by bootstrap table isn’t working

Tags: , , , ,

I will write a method, that gives the Cell value from the clicked Bootstrap table. When I click at first the table heading, the th function was called. After that, I can’t click on the cells. The tdOnClick() method is only working before I click to th. Why is that so?

my JS:

//if a cell was clicked, this function was called
function tdOnClick(){
    var col = $(this)[0].textContent;


You must add your tdOnClick() function after the function which creates your table body

Source: stackoverflow