Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:26:40+00:00 2026-06-11T00:26:40+00:00

function createDynamicTable(tbody, rows, cols) { if (tbody == null || tbody.length < 1) return;

  • 0
 function createDynamicTable(tbody, rows, cols) {
    if (tbody == null || tbody.length < 1) return;
    for (var r = 1; r <= rows; r++) {
        var trow = $("<tr>");
        for (var c = 1; c <= cols; c++) {
            var input = $("<input />");
            $("<td>")
                    .addClass("tableCell")
                    .append(input)
                    .data("col", c)
                    .appendTo(trow);
        }
        trow.appendTo(tbody);
    }
}

This script is called on the on change event of a select tag, whenever I change the option and generate a table.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:26:42+00:00Added an answer on June 11, 2026 at 12:26 am

    I’m not sure I understand your problem correctly but I would certainly try moving

    var trow
    var input
    

    outside the for loops, if it won’t solve anything else, it would make the function more efficient. also I suspect that because of scoping issues:

    trow.appendTo
    

    won’t have trow variable defined when you try to append

    edit: I’ve made a working jsBin with this working. I don’t understand what is the exact problem or question:

    another edit: If the question is (as I presume) about binding to select box change, I’ve changed the JsBin accordingly .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function countChars(elm) { if (elm.nodeType == 3) { // TEXT_NODE return elm.nodeValue.length; } var
function levenshtein(a, b) { var i,j,cost,d=[]; if (a.length == 0) {return b.length;} if (b.length
function getsession(){ var data = $.get('../session', function(data) { return data; }); return data; }
function checkuser(user) { var ret = false; $.ajax({ type:'POST', url:'user.php', async:false, data:{'user':user}, success:function (data)
function getDbValue() { alert($('[data-bind]').length); alert($('[data-bind][0].data-bind')); alert($('[data-bind][0].value')); jQuery.each($('[data-bind]'), function(databind,key) { alert(key); alert(databind); alert(databind[key].data-bind); }) }
function dowork() { $(.wrappedElement).removeClass(wrappedElement); $(.wrappedElementout).removeClass(wrappedElementout); var a=$(div#DepPart select option:selected).val(); $(div#TestPart select option[value^=a]).addClass(wrappedElement); $(div#TestPart select
function parseAttach(b) { var h=; for(i=0;i<b.length;i++) { var a=b[i]; switch(a['type']) { case image: h+='<li
function deleteRecordDialog() { var returnThis; var numRecordss = recs.length; var html = /*html= html
function lookupRemote(searchTerm) { var defaultReturnValue = 1010; var returnValue = defaultReturnValue; $.getJSON(remote, function(data) {
function uploadify() { $file = $this->input->post('filearray'); $data['json'] = json_decode($file); print_r($data); $name = $this->$json->{'file_name'}; echo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.