[solved]JavaScript element id for textarea tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[solved]JavaScript element id for textarea tag

I want to create a Variable that's value is same as the textarea but It need to be from id and I tried it didn't work with var a = document.getElemntById("codeinput")

4th Jun 2022, 1:52 PM
heaker Gamer
26 Answers
+ 3
To read the text inside the textarea and assign it to a variable let text = document.getElementById("codeinput").value; I think you need to clarify what is meant by "all the data from this tag" it's not clear which data was referred to in that line.
5th Jun 2022, 2:42 AM
Ipang
+ 3
Can I see that code so I can check what was wrong?
4th Jun 2022, 2:17 PM
Ipang
+ 2
temp=Document.getElementbyid('codeinput') Document.write(temp.value)
4th Jun 2022, 5:02 PM
Mihir Lalwani
Mihir Lalwani - avatar
+ 2
heaker Gamer sorry then i don't know the answer
4th Jun 2022, 6:05 PM
Mihir Lalwani
Mihir Lalwani - avatar
+ 2
Ipang check my answer is it same
5th Jun 2022, 3:12 AM
Mihir Lalwani
Mihir Lalwani - avatar
+ 1
Didn't work
4th Jun 2022, 5:22 PM
heaker Gamer
+ 1
heaker Gamer, It works for me. Why don't you share your code link so we can see what is wrong? you saying "Didn't work" but you're not showing what you're doing. https://www.sololearn.com/post/75089/?ref=app
5th Jun 2022, 3:21 AM
Ipang
+ 1
Mihir Lalwani Javascript is case sensitive ...
5th Jun 2022, 3:22 AM
Ipang
+ 1
Well we can't help you with that code being in a .zip file ¯\_(ツ)_/¯ Good luck with that!
5th Jun 2022, 3:32 AM
Ipang
+ 1
heaker Gamer, You can split the string and use different index to access the array depending on the frame. const arr = "Hello world".split( " " ); // in frame #1 let a = arr[ 0 ]; // in frame #2 let a = arr[ 1 ];
5th Jun 2022, 3:58 AM
Ipang
+ 1
But the divice wouldn't know how much words are there like I am creating my own programing language so
5th Jun 2022, 4:00 AM
heaker Gamer
+ 1
I see you're making your own language. But the problem here I don't clearly understand what you want to do. Like what are those "frame" you talk about? it's confusing ...
5th Jun 2022, 4:02 AM
Ipang
+ 1
hello there what's the solution of the 27.7 practise exercise of the python beginner course? ------------------------------------------------ Prob: Write a program that takes an input string and outputs the 3rd character of the string. this does work only for case 1 and not case 2: a = str("hello") print(a[2]) Viceversa then it works for case 2 and not 1. AND PUTTING THEM TOGETHER RESULTS IN AN ERROR. ------------------------------------------------ Any ideas? thank you very much indeed.
6th Jun 2022, 6:34 AM
Jonathan Trapella
+ 1
It's JavaScript
6th Jun 2022, 7:43 AM
heaker Gamer
0
Didn't work
5th Jun 2022, 3:18 AM
heaker Gamer
5th Jun 2022, 3:20 AM
heaker Gamer
0
It's .zip file
5th Jun 2022, 3:23 AM
heaker Gamer
0
It need to be debuged now done!
5th Jun 2022, 3:30 AM
heaker Gamer
0
Now there is another question
5th Jun 2022, 3:35 AM
heaker Gamer
0
How will make it like variable has text "Hellow World" I want to do is in first frame a new variable as a will do A = hellow In second frame it's A = wolrd
5th Jun 2022, 3:37 AM
heaker Gamer