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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:13:08+00:00 2026-06-11T16:13:08+00:00

UPDATE I am trying to add a group which include textboxes and simple text

  • 0

UPDATE

I am trying to add a group which include textboxes and simple text in html using the onClick function

This is the html part of the button

    <div id="dynamicForm">
        <input type="submit" name="Add_fields" value="+" onclick="generateRow()">
    </div>

and the js

    <script>
function generateRow()
{
    document.getElementById('dynamicForm').innerHTML +='
                    <input name="dneven" type="text" width="30"/>
                        дневен
                    <select name="zapl">
                        <option selected="selected" value="3">-----</option> 
                        <option 1>платен</option>
                        <option 2>неплатен</option>
                    </select>
                        отпуск от  
                    <select name="god">
                        <option selected="selected" value="11">---</option>
    <option 1>2011</option>
    <option 2>2012</option>
                    </select>г.
                ';
}
</script>

But it doesn’t do anything. Where is my mistake and also how can I make the button to dissapear after it is pressed once? I’ll appreciate all your help thanks in advance.

  • 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-11T16:13:09+00:00Added an answer on June 11, 2026 at 4:13 pm

    You have a syntax error here because you your quotes.

    innerHTML+="<input name="name" type="text" width="30"/> some text <input name="name" type="text" width="30"/>";
    

    Here is a syntactically correct version. Note the string is in single quotes, which means the double quoted HTML attributes won’t accidentally terminate the string.

    innerHTML+='<input name="name" type="text" width="30"/> some text <input name="name" type="text" width="30"/>';
    

    If you are still stuck, you may need to give us a little more code – have you used innerHTML as a short-hand to the actual innerHTML of an element or is it a variable declared somewhere?

    Update

    I haven’t declared innerHTML anywhere

    If you want to add your string of HTML to an element, you’ll need to use:

    document.getElementById('myElementId').innerHTML += 'html string';
    

    As just putting

    innerHTML += 'html string';
    

    Creates an implicit global variable (and errors because you are trying to append to something that doesn’t yet exist).

    Update

    I want to insert the HTML right after the button

    HTML:

    <div id="dynamicForm">
        <input type="submit" name="Add_fields" value="+" onclick="generateRow()">
    </div>
    

    JS:

    function generateRow() {
        document.getElementById('dynamicForm').innerHTML += '<input name="name" type="text" width="30"/> some text <input name="name" type="text" width="30"/>';
    }
    

    Later on, you might want to get into creating elements and appending them to the DOM without using strings and adding the event handlers in script rather than HTML – but this should get you started.

    Update

    You can’t have line-breaks in your string in JavaScript, so you need either one line, or lots of appends. Working example here.

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

Sidebar

Related Questions

I'm trying to update (add/modify files) an existing JAR file, and this code (using
I am trying update text views while this loop is processing. Here is my
This is the VBA code for an Excel template, which I'm trying to convert
I am trying to update the Roles a specific group has in my application.
I'm trying to use checkboxes to add users to a specific group but I'm
Simple (I hope), HTML question. Let's say I have a column group that spans
I am trying to add a file to a model using qqfile (though that
I'm trying to add two BitSet objects together (mutating one of them). This should
I am trying to add alert for loging user using programming. It is giving
I am trying update my version of sqlite3 on mac os x 10.5.7 I

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.