answersLogoWhite

0


Best Answer

Assuming that you already have the form in place and you simply want to add the value into an input field, you would use the following code.

// I'm setting a variable to hold our stuff in.

var pepperidgeFarms = "I love the fishes 'cause they're so delicious.";

// Get a reference to form input. Here I assume the id is "goldFish".

// Then simply set the value property of the input.

document.getElementById("goldFish").value = pepperidgeFamrs;

I've included a working example via JS-Fiddle in the related links.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you display the values entered in text in javascript?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is embedding java script?

To embed JavaScript code is to include it in the HTML page. For example, this will embed the code to display an alert: <script type="text/javascript"> alert("Embedded alert!"); </script>


What is HTML code of Display text after click on submit button?

To create a button that displays text after being clicked, you can use HTML and JavaScript. Here's an example code: HTML: <button onclick="displayText()">Submit</button> <p id="text"></p> JavaScript: function displayText() { document.getElementById("text").innerHTML = "Text to display after clicking submit button."; } In this code, the button is created using the <button> tag and an onclick attribute is added to call the displayText() function when clicked. The function displayText() uses JavaScript to access the element with the ID "text" and change its innerHTML to the desired text, which will be displayed below the button.


What is the difference between head tag and body tag in HTML?

Code in the head tag will be executed before that in the body, because of the order of page loading. Additionally, anything written to the body using the document.write method goes in the position of a script tag in the body


Calculations in HTML?

HTML is a static language, you cannot do any math using only HTML. To do math, you need a scripting language such as JavaScript. Try this code: <script type="text/javascript"> document.write((2+3)*2); </script> put this in your HTML page and it should display as 10


What two tags does javascript have to be enclosed in?

as far as i know they are: <script type="text/javascript"> all my lovely javascript code!!! </script>

Related questions

How do you display the text entered by the user in a html page on the same html pagelike i mean that real time entering the data by the user and displaying the data back to the user what he have enter?

You can do it by referring the input type in javaScript. Then you can get the value by id in the same and display it.


What is embedding java script?

To embed JavaScript code is to include it in the HTML page. For example, this will embed the code to display an alert: <script type="text/javascript"> alert("Embedded alert!"); </script>


What is HTML code of Display text after click on submit button?

To create a button that displays text after being clicked, you can use HTML and JavaScript. Here's an example code: HTML: <button onclick="displayText()">Submit</button> <p id="text"></p> JavaScript: function displayText() { document.getElementById("text").innerHTML = "Text to display after clicking submit button."; } In this code, the button is created using the <button> tag and an onclick attribute is added to call the displayText() function when clicked. The function displayText() uses JavaScript to access the element with the ID "text" and change its innerHTML to the desired text, which will be displayed below the button.


What does PROMPT command do in operating system?

with the PROMPT command type "prompt text", text being what you want it to say. now, instead of displaying the drive path, it will display what you entered as the text.


What is the difference between head tag and body tag in HTML?

Code in the head tag will be executed before that in the body, because of the order of page loading. Additionally, anything written to the body using the document.write method goes in the position of a script tag in the body


Functions used to display text or values if certain conditions exist?

Logical functions like IF functions or others can be used.


Different text control tags?

Some Text control tags are * <FONT> to decide the display font * <B> to display text in Bold * <I> to display text in Italics * <H1> to <H6> to display text in header format * etc...


Calculations in HTML?

HTML is a static language, you cannot do any math using only HTML. To do math, you need a scripting language such as JavaScript. Try this code: <script type="text/javascript"> document.write((2+3)*2); </script> put this in your HTML page and it should display as 10


Can you hide and reveal text e.g YouTube comments without the use of javascript I wanted to try it on Myspace but it disables javascript.?

Very unlikely. See, Javascript is used to change the className attribute of the text node. When the className has changed, the node uses the properties that are set with CSS. This means you can keep a text invisible with CSS only, but you'll always need Javascript to switch classes.


How do you display strikeout in HTML?

To display strikeout text use the <strike> tags. Example: <strike>Text</strike> Should Display: Text


How do you put a JavaScript variable into the value of a HTML text box?

If your text box has the ID foo and your JavaScript variable is named bar, then you can use the following code to put the value of the variable into the text box:document.getElementById("foo").value=bar;


What two tags does javascript have to be enclosed in?

as far as i know they are: <script type="text/javascript"> all my lovely javascript code!!! </script>