javascript - Dynamic table generation in jQuery -


how can dynamically generate html <table> variable number of rows?

the number of rows depend on number of properties exist within javascript object.

function showtable(trnum) //number of table rows passed in {    // how?    // $("#elem").foo // #elem - element container table } 

function showtable(trnum) {     var tablecode = "<table>";     (var i=0; i<trnum; i++) {         tablecode += "<tr>" + "stuff inside each tr ?" + "</tr>";     }     tablecode += "</table>";     $("#elem").append(tablecode); } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -