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 trying to just write a simple PHP if statement that checks if a
I'm trying to write a simple program in VC++ which will just initialize the
I'm just starting out writing trying to write a simple program in C and
Hey i'm just trying to write some code in DrScheme: ((function (x) (* x
I'm trying to write (or just find an existing) PHP method that can take
I have a PHP form that needs some very simple validation on submit. I'd
I'm trying to write a simple PHP script which automatically sets up new etherpads
Is there a library that would let me write regexp-like queries for lists of
We have a database of loyalty card holders. I'm trying to write a simple
I am trying to write a simple program that prints out a C string

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.