0
How can we print multiple outputs with single input tag in html?
Please explain if u know the answer
11 ответов
+ 6
html
<div id='out'>
JS
function copyText() {
for (var i=0; i<5; i++) {
var P = document.createElement("P");
P.innerText = xIn.value;
xOut.appendChild(P);
}
}
+ 3
I made a simple example. The javascript is in the bottom of the html tab.
https://code.sololearn.com/WmkJm6zRvdLc/?ref=app
+ 2
Can you give examples for input and output? I think I don't understand the question yet...
+ 1
Do you mean multi-line input? You could use <textarea> maybe?
+ 1
Oh, okay. Then it isn't important if the output is textarea or a simple paragraph.
You need write a function that gets the input text and inserts it in the output. This function would be attached to your button. Can you link your code?
+ 1
Personally, I would use a label tag for this purpose. It has the ability to be pre-formatted and is inline. It supports postback and is better than the literal tag.
0
Lisa,it is like whatever txt you are giving in input it should be printed example if u give
—-------------Inputs---------------------as
hi this is little coder
Hello html etc..
----------------------------------------------------
And the output be as
hi this is little coder
Hello html etc.. Like in this format I hope u understood😅
0
Lisa,😅OK I mean
For example:--
<textarea></textarea>tag and one button tag
-->if I give input in txtarea tag as "hello" and I click the button
It should be printed as "hello"
And for another input as "bye " and button click the output as
hello
bye
Like in this format I have to get the output. I can't understand how to write js code for it. do u think you can help me to solve it.
The best example like the messenger app whattever you write the output be printed
0
Lisa, you get it but I am sorry I don't know how to write the code for that, can u help me for that
Like my code in this format
______________________________
<p id="Pri" ></p>
<input id="inp" type="text" >
<button onclick="sendi()" >send</button>
In script like
function sendi(){
var a=document.getElementById ('inp');
document.getElementById('pri'). innerHTML=a.value;}
___________________________
In this how can i make p tag to print the upcoming values of the input
0
Lisa, I like the code but it's not gonna work becoz when u giving input it is printed after clearing the
Input data and giving another input the previous output gone and the current input is printed. I need the both outputs to be printed Hope u understand 😅
0
Little Coder
This is very simple thing to do.
Why don't you learn JavaScript first ??