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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:33:20+00:00 2026-05-22T18:33:20+00:00

i am just tyring to write a simple code that would print a user’s

  • 0

i am just tyring to write a simple code that would print a user’s input. here’s what i have:

<script type="text/javascript">
    function displayText() {
        var input = document.getElementById('input').value;
        document.getElementById('p').innerHTML = input;
        }
    }
</script>

and

<font face="arial" size="5" color="blue">Input section</font> <br/>
Query Sequence
<form name="form">
<textarea id="input" rows="8" cols="60" id="input" ></textarea><br/>
<button type="button" style="height: 25px; width: 100px" onClick="displayText()">Display Date</button><br/>
<p id="p"></p>
</form>

i have no idea why it doesn’t work…
and another little question: what is the difference between assigning an ID and a name to a form tag in html? thanks!

  • 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-22T18:33:21+00:00Added an answer on May 22, 2026 at 6:33 pm
    function displayText() {
        var input = document.getElementById('input').value;
        document.getElementById('p').innerHTML = input;
        } <--- extra brace
    }
    

    EDIT: in response to the note:

    what is the difference between
    assigning an ID and a name to a form
    tag in html

    An ID uniquely identifies the element, and can be used in either CSS styling, or to quickly obtain the element in JavaScript as you are doing.

    The name attribute is what’s used by the server side to identify the element and get it’s value. For example:

    <textarea id="input" name="textinput" rows="8" cols="60" id="input" ></textarea>
    

    If this form was posted to a PHP script, you would access the value with like this:

    echo $_POST['textinput'];
    

    You can also navigate to elements using the name, but it’s not recommended.

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

Sidebar

Related Questions

I'm wondering if there's any way to populate a dictionary such that you have
I am trying to write the syntax to add up ten user-inputted numbers in
I have written a code in Python to create a transition probability matrix from
I tried to search forum topics to find a tutorial that will guide me
I'm just starting to get into backbone.js. It looks like it's pretty involved and
I am rewriting some old JavaScript with jQuery and would like to know how
I am trying to write a bit of Objective-C (which is new for me,
I'm trying to get a simple effect to display using WebGL. Naturally, this means
I'm new to OO programming, and I'm trying to understand how to assign values
my issue is a bit similar to this one: Having an issue with my

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.