Skip to content
Advertisement

Click a Cell by bootstrap table isn’t working

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;
    console.log(col);
}

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement