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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:55:19+00:00 2026-06-17T12:55:19+00:00

I tried to build an application in which , there is one HTML page

  • 0

I tried to build an application in which , there is one HTML page from which I get single input entry by using Submit button, and stores in the container(data structure) and dynamically show that list i.e., list of strings, on the same page

means whenever I click submit button, that entry will automatically
append on the existing list on the same page.

But in this task, firstly I try to catch that input in javascript file, and I am failing in the same. Can you tell me for this, which command will I use ?

Till now my work is :-

HTML FILE :-

<html>
    <head>
        <script type = "text/javascript" src = "operation_q_2.js"></script>
    </head>
    <body>
        Enter String : <input type= "text" name = "name" id = "name_id"/>
        <button type="button"   onClick = "addString(this.input)">Submit</button>
    </body>
</html> 

JAVASCRIPT FILE:-

function addString(x) {
    var val = x.name.value;
    //var s = document.getElementById("name_id").getElementValue;//x.name.value;
    alert(val);
}

EDITED

My New JAVASCRIPT FILE IS :-

var input = [];

function addString(x) {
    var s = document.getElementById("name_id").value;//x.name.value;
    input.push(input);
    var size = input.length;
    //alert(size);
    printArray(size);
}

function printArray(size){
    var div = document.createElement('div');
    for (var i = 0 ; i < size; ++i) {
        div.innerHTML += input[i] + "<br />";
    }
    document.body.appendChild(div);
    //alert(size);
}

Here it stores the strings in the string, but unable to show on the web page.

  • 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-17T12:55:21+00:00Added an answer on June 17, 2026 at 12:55 pm

    See this fiddle: http://jsfiddle.net/MjyRt/

    Javascript was almost right

    function addString(x) {
        var s = document.getElementById("name_id").value;//x.name.value;
        alert(s);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a hadoop application which can read words from one file
I'm looking to build a tree-like structure for my Java application. I've tried using
Hallo, I'm using CMake as build system in one of my projects which is
I am new in Javascripting language. I tried to build an application in which
I tried to build an index over a two columns of a 30,000,000 entry
Has anyone tried to build an e-commerce site atop MS Dynamics, using the new
I tried to reuse the .pch to speed the build using the following way:
I am trying to build an ASP.NET MVC application, which will use Thumbor as
I have build an C# Winforms application which will need regular updates and patches
I have two sets of identical html and css files. One of which I'm

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.