+ 1
HTML form/textarea data
how can I take the data put into a form or textarea and utilize that data? for example, if i wanted to make sure they typed blue and not red. https://code.sololearn.com/WViV8wp6Ntyt/?ref=app
7 odpowiedzi
+ 2
Oh cool Thanks for adding code for clarity 👍
Well, there's just one tiny issue here, you were reading the innerHTML attribute rather than value, if you read the value attribute you'll get it right.
if (document.getElementById("cmd").value === "$cmd")
There, try it like that, that's how I got it working.
+ 2
a form does take input. if it ask for "first name" for example, as many examples do, it requires input. Also, ive tried that and it doesnt work. When a site like Google asks for your username, how does it read what you wrote?
+ 2
done 😁 cmd simulator lol
+ 2
it worked, thank you so much for your help
+ 2
You're welcome! alright, good luck with that simulator 👍
+ 1
I guess you can specify Id attribute for the textarea then use document.getElementById() function to obtain its value attribute when you need it. Once you have the value you can compare it with "blue" and see if they match.
I don't understand what you mean by "data put into a form", as I understand it, form doesn't take input (I could be wrong).
0
I'm not sure how Google does it, as it is a tech giant it must be using some advanced techniques for it's sites.
Can you attach your code link on Description section of your original question (above)?