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 7527097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:01:28+00:00 2026-05-30T04:01:28+00:00

I have the following page: <div style=display: inline> <input type=button id=txt value=Add TextBox style=

  • 0

I have the following page:

<div style="display: inline">
<input type="button" id="txt" value="Add TextBox" style="" />
</div>
<br />
<h1 id="headerBuilder">Build the New Control</h1>
<table id="tblControls" width="50%"table>
<br/>
<input type="button" id="btnProcessControl" value="Generate New" />

In my JQuery code I create two table rows, each with two table data cells.

function displayTxtBuilder() {
    $("#tblControls").contents().remove();

    var $MaxLengthQuestion = $('<label />').text('Set the Max Length Value:');
    var $MaxLengthInput = $('<input/>').attr({ type: 'text', id: 'maxlength', size: '3', maxlength: '3', value: 'max' });
    var $BodyQuestion = $('<label />').text('Set the initial value of the textbox:');
    var $BodyInput = $('<input/>').attr({ type: 'text', id: 'body', size: '3', value: 'body' });

    $("#tblControls").last().append(
                $TableRow.append($TableData.append($MaxLengthQuestion)).append($TableData2.append($MaxLengthInput))
            );

    $("#tblControls").last().append(
                $TableRow2.append($TableData3.append($BodyQuestion)).append($TableData4.append($BodyInput))
            );
}

I thought that the code

$("#tblControls").contents().remove();

would remove all the contents of tblControls, but instead I see the $TableRow.append being repeated everytime I run displayTxtBuilder. Not sure why its doing only repeating the first append. On the other hand, if I replace

$("#tblControls").contents().remove();

with

$("#tblControls").remove();

none of the .last().append() rows show up.

  • 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-05-30T04:01:30+00:00Added an answer on May 30, 2026 at 4:01 am

    Use empty()

    $("#tblControls").empty();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code (on a xhtml page) <div style=background-color:#006400;> <div id=div1 style=display:inline-block;
I have the following code on my page: <p align=justify style=font-size:10pt;display:block;height:200px;vertical-align:middle;> Content </p> I
I have the following form declaration: <div class=edit-dialog span-10 style=display:none;> <div class=edit-message span-10 style=margin-bottom:30px;>
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
in my html page, I have the following: <div id=rub> Select at least one
I have a page with the following two divs: <div id=searchResults> </div> <div class=postSearchOptions
I have the following Javascript libraries loaded for my page. <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js></script> <script
I have the following: <ul style=width: 300px; list-style-type:none> <li> <table style=width:100% border=0 cellpadding=0 cellspacing=0
I'm trying to teach myself CSS and have the following markup: <style type=text/css> #content
I have in my page a button which when clicked displays a div (popup

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.