Skip to content
Advertisement

How to print table rows data in console

I’ve created dynamic table rows using javascript for loop and I want to fire a click event on row in a way that whenever user clicks on any row it should be visible in console log.

JavaScript

I know there are many answers for this but I tried and none helping me and some prints as undefined.

Here is what I tried:

JavaScript

Advertisement

Answer

Your javascript code looks correct to me but I think you’re not placing it at correct place.

Try this:

JavaScript
Advertisement