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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:24:53+00:00 2026-05-28T07:24:53+00:00

I wrote the following javascript to dynamically build a calendar and append it to

  • 0

I wrote the following javascript to dynamically build a calendar and append it to a designated div. It works and the calendar looks fine in the browser.

$('#Calendar').append('<table><thead><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th>Sunday</th></thead><tr>');

for (i = 0; i <= loop; i++) {
    if ((i == 7) || (i == 14) || (i == 21) || (i == 28) || (i == 35)) {
        $('#Calendar').append(loopDate.getDate() + "</tr><tr>");
        $('#Calendar').append('<td>' + loopDate.getDate() + '</td>');
        loopDate.addDays(1);
    } else {
        $('#Calendar').append('<td>' + loopDate.getDate() + '</td>');
        loopDate.addDays(1);
    }
}
$('#Calendar').append('</table>');

}

However, when I inspect the resulting HTML for the page I see that my <tr></tr> are not landing in the correct place. There also appears to be an extraneous appended . Can someone please explain to me why this is happening?

<div id="Calendar">
<div></div>
<table>
 <thead>
  <tr>
  <th>Monday</th>
  <th>Tuesday</th>
  <th>Wednesday</th>
  <th>Thursday</th>
  <th>Friday</th>
  <th>Saturday</th>
  <th>Sunday</th>
  </tr></thead>
  <tbody>
  <tr></tr>
  </tbody>
  </table>
  <td>26</td>
  <td>27</td>
  <td>28</td>
  <td>29</td>
  <td>30</td>
  <td>31</td>
  <td>1</td>
  <tr></tr>
  <td>2</td>
  <td>3</td>
  <td>4</td>
  <td>5</td>
  <td>6</td>
  <td>7</td>
  <td>8</td>
  <tr></tr>
  <td>9</td>
  <td>10</td>
  <td>11</td>
  <td>12</td>
  <td>13</td>
  <td>14</td>
  <td>15</td>
  <tr></tr>
  <td>16</td>
  <td>17</td>
  <td>18</td>
  <td>19</td>
  <td>20</td>
  <td>21</td>
  <td>22</td>
  <tr></tr>
  <td>23</td>
  <td>24</td>
  <td>25</td>
  <td>26</td>
  <td>27</td>
  <td>28</td>
  <td>29</td>
  </div>
  • 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-28T07:24:53+00:00Added an answer on May 28, 2026 at 7:24 am

    jQuery methods such as append() manipulate the browser’s DOM tree.
    The DOM holds complete HTML elements. You can’t put in half of a tag.

    Instead, you can concatenate HTML into a string (or, for better performance, an array), then put the complete HTML string into the DOM at once.

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

Sidebar

Related Questions

Javascript can manipulate the document the browser is displaying, so the following: <script> document.write(<table><tr><td>Hola</td><td>Adios</td></tr></table>);
I wrote the following javascript to put in my startup folder to work around
I wrote a javascript method to display an image dynamically depending on whether or
I wrote the following class in javascript function main() { this.area ; this.$= function(target)
I'm using jQuery 1.3.2: <script src=../../Scripts/jquery-1.3.2.js type=text/javascript></script> I've got the following html: <div id=container-div>
Awhile back, I found the following javascript function that allows you to dynamically add
I wrote the following simple javascript code <html xmlns=http://www.w3.org/1999/xhtml xml:lang=en lang=en> <head> <title>ajax</title> </head>
I wrote the following code in Javascript. function main() { this.a ; this.set =
I wrote the following html file <code> <html> <head> <script text =text/javascript> function createCookie(name,value,days)
I wrote a javascript like following: <script language=javascript type=text/javascript> var name = new Array();

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.