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

  • Home
  • SEARCH
  • 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 9000645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:20:12+00:00 2026-06-16T00:20:12+00:00

Im having trouble creating multiple input texts with javascript. My point is create a

  • 0

Im having trouble creating multiple input texts with javascript.

My point is create a new input text everytime the input before is completed. (parent?)

Ive some code for comboboxs, but this time I need just input text box.

How can I do that ?

I’ve found this code:

<script type="text/javascript">
function addInput()
{
    var x = document.getElementById("inputs");
    x.innerHTML += "<input type=\"text\" />";
}
</script>

<input type="button" onmousedown="addInput();" />
<div id="inputs"></div>

But for my problem button is obsolete.

I think my event trigger will be something arround this “when user click in an input text box and it is != blank it creates a new one”.

I migth need some ID to identify every input text box.

Cheers.

  • 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-16T00:20:12+00:00Added an answer on June 16, 2026 at 12:20 am

    JSBIn Demo

    Guess this helps:

       <div id="myDiv">
            <input type="text" id="txt_1" onkeydown="newTextBox(this)" />
       </div>
    
    <script type="text/javascript">
    
    function newTextBox(element){
       if(!element.value){
           element.parentNode.removeChild( element.nextElementSibling);
           return;
       }
       else if(element.nextElementSibling)
           return;
        var newTxt = element.cloneNode();
        newTxt.id = 'txt_'+( parseInt( element.id.substring(element.id.indexOf('_')+1)) + 1);
        newTxt.value='';
        element.parentNode.appendChild(newTxt);
    }  
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble creating multiple AS3 classes, I've got my document class but can't
so I'm having trouble properly creating this query. Basically, I want to insert multiple
I'm having trouble creating a new model row in the database using ActiveRecord in
I'm having trouble creating multiple xml requests using php's curl_multi_exec. The problem is that
I am having some trouble creating a before aspect for a method that has
When dealing with multiple classes in a Javascript/NodeJS game, I'm having trouble figuring out
I'm having trouble creating multiple pages in a PrintDocument and displaying them within a
I am having trouble in creating and displaying multiple game objects on the screen
Hey I'm new to Flash AS 3.0 and I am having trouble with creating
I am having trouble creating a layout for a dialog I want to display

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.