0
How does textarea work?
TextArea is one of the most confusing tags(for me...) in html.. I don't know how coders can create those compilers for svar... https://code.sololearn.com/W5uDrnMqdP4E/?ref=app
7 Answers
+ 1
here's how it works
* line no. 151
var lines = document.getElementById("program").value.trim().split("\n");
when you press the submit button, whatever is written in textarea is stored in lines variable separated by new lines("\n").
*line no. 154 - 165
for (var i = 0; i < lines.length; ++i)
{
var line = lines[i].trim();
if (line != "" && (line.indexOf(";") == -1 || !line.endsWith(";")))
res += "Error: [;] needed at line [" + (i + 1) + "]\n";
else
{
//var phrases = line.split(";");
var phrases = line.split(/(?!\B"[^"]*);(?![^"]*"\B)/);
for (var j = 0; j < phrases.length; ++j)
parse(i + 1, phrases[j].trim());
}
}
lines is passed into for loop, then everything separated by space and stored in array
then the array is passed to evaluate and parse function where they evaluate the contents
any other doubt??
+ 1
are you refering to textarea tag??
+ 1
left one is for input
right one for output
0
Sreejith yes
0
textarea
read this
https://www.w3schools.com/tags/tag_textarea.asp
if you have any doubt, ask me
0
Sreejith yes but how can JavaScript read what's on the text area
0
thanks