How does textarea work? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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

16th Jun 2018, 7:02 AM
Renz Frederick Bañas
Renz Frederick Bañas - avatar
7 Respuestas
+ 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??
16th Jun 2018, 12:41 PM
‎ ‏‏‎Anonymous Guy
+ 1
are you refering to textarea tag??
16th Jun 2018, 7:46 AM
‎ ‏‏‎Anonymous Guy
+ 1
left one is for input right one for output
17th Jun 2018, 3:11 AM
‎ ‏‏‎Anonymous Guy
0
Sreejith yes
16th Jun 2018, 8:23 AM
Renz Frederick Bañas
Renz Frederick Bañas - avatar
0
textarea read this https://www.w3schools.com/tags/tag_textarea.asp if you have any doubt, ask me
16th Jun 2018, 8:30 AM
‎ ‏‏‎Anonymous Guy
0
Sreejith yes but how can JavaScript read what's on the text area
16th Jun 2018, 8:45 AM
Renz Frederick Bañas
Renz Frederick Bañas - avatar
0
thanks
16th Jun 2018, 1:05 PM
Renz Frederick Bañas
Renz Frederick Bañas - avatar