Skip to content
Advertisement

I want to create a html table layout in jQuery

I am trying to create an Html table layout using jQuery but I don’t know where I am doing mistakes.

When I try to run this and check the console tab the error comes with undefined( i and table2)

I just want to show the table on the chrome page means I want the output.

JavaScript
JavaScript

Advertisement

Answer

Simpling adding console.log inside a script tag in you required place will not add the content to the DOM. You have to manipulate the template as string and set it as the html content of the target using html method in jQuery.

Also the loop index used in the for loop was j and you were consoling it with i. The index was looping till 10. But you have only 5 columns inside a row. If that is not purposeful, you have to user loop from 1 to 5

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