Dynamic tables with jQuery -


How can I create a dynamic tables with jQuery? Example: jQuery dialog asks the user how many lines he wants to host? Users enter multiple rows and then jQuery creates rows from that number. I think it can be done with jQuery, but how to do it?

The simplest table forming function look something like this

  function makeTable (Columns, rows) {var html = "& lt; table & gt;", // start your html tmpCols = 0; // loops to use the temporary variable while loop html = "" through lines (rows -) {// rows; Tr & gt; "; // Start a new line passing the number of tmpCols = cols; // cache columns (tmpCols--) {// column html + =" & lt; Td> & Lt; / Td> "Add loop; // new cells through html} =" & lt; / tr & gt; "// off line} html + =" & lt; / Table & gt; "; // Close the table return HTML; // Return HTMT}   

Surely you have more control over different aspects of the table (characteristics or content, etc.) You may want to keep it updated with more information about the need for your question and then we can help you better :)

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -