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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:55:36+00:00 2026-05-24T16:55:36+00:00

Hello I’m trying to create text boxes dynamically using for loop and want to

  • 0

Hello I’m trying to create text boxes dynamically using for loop and want to implement calendar in all of them. my code is as follows:

for (var j = 1; j <= 5; j++) {

my_proj.innerHTML = my_proj.innerHTML +'<input type="text" name="txtStartDate" id="txtStartDate"+j runat="server" BackColor="#D6E4ED" BorderStyle="Inset" Width="10px" ></input>'
+'<a href="javascript:;" onclick="window.open(\'PopUp.aspx?textbox=txtStartDate+j\',\'cal\',\'width=250,height=225,left=270,top=180\')">'

}

As I need to have separate id for all the text boxes I tried to concat the variable j with it. But its not working and giving the error as 'Unknown identifier "startDate"+j"'.
Please suggest something to solve this. Any other idea to work this out will also do. BTW I’m trying to implement it inside an .aspx page.

Thanks in advance.

Can anyone give me any other example to implement the same???? please.

  • 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-24T16:55:36+00:00Added an answer on May 24, 2026 at 4:55 pm

    You have to close the string before appending the variable to the string, so that it is recognized as a variable, and not just the letter ‘j’.

    So . . .

    var j = 10,
        str = "He is j years old";
    

    . . . won’t work; you need to do this:

    var j = 10,
        str = "He is " + j + " years old";
    

    Your code should look like this:

    my_proj.innerHTML = my_proj.innerHTML +'<input type="text" namea="txtStartDate" id="txtStartDate' + j +'" runat="server" BackColor="#D6E4ED" BorderStyle="Inset" Width="10px" ></input>'
    +'<a href="javascript:;" onclick="window.open(\'PopUp.aspx?textbox=txtStartDate' + j + '\',\'cal\',\'width=250,height=225,left=270,top=180\')">'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am trying to create a stacked barplot using the following code: test
hello friends i am trying to get a list of user id and want
Hello I'm making RSS reader and I'm using DOM. Now I stuck, trying to
Hello i been trying to get a tokenizer to work using the boost library
Hello I want to convert a PDF file to text file. I am converting
Hello I am trying to do a SOAP request here is my code: #
hello I am using ubuntu on android(with chroot) I am trying to execute xev
hello i want to add param value to all the object in a page.
Hello I'm trying to take backup from mysql command line client. I'm using mysqldump
Hello All I am trying to flatten a list in Ocaml. I am a

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.