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
Post a Comment