I know you guys aren't a tech support forum, but I'm pretty lost with this. Maybe this is stupid question, but I'm writing a program in Javascript and I'm stuck on this weird DOM issue.
So I know that you can input the value of a variable into an document element like so:
> document.getElementById("idhere").innerHTML = variable.value
My question is, is it at all possible to take the value from an existing document element and input it into a variable?
Before everybody asks why, I have a program that takes a value (points), assigns it to a variable, and then prints it to a element before it begins executing other functions that take points away. I need a way to refer back to the original point value.
>>55601592
Do you even understand whatdocument.getElementById("idhere").innerHTML = variable.valuedoes?
>>55602759
What an awesome response. This is why everyone loves g.
Ask a question that people either don't know the answer to or feel is beneath them, and get a shitty response. The typical answer is flying into an autistic rage about how /g/ is not a tech support forum, while failing to realize that asking questions are a normal part of any forum. Logically it follows that people are going to (on a technology forum) ask questions about technology. This is a convenient mechanism for the mentally retarded to dodge the questions they either don't know how to answer or feel are beneath them, while simultaneously allowing them to showcase their stuff on questions that they want to answer - typically leading to pathetic internet arguments.
That's right, everybody on /g/ was born knowing all of javascript. While the rest of us mere mortals use tools like codeacademy or going to school, certain babies just pop out of their mother's wombs already knowing everything about javascript and have a gigantic "/g/" birthmark on their forehead. It's so stupid that the rest of us mere mortals wouldn't understand something and ask for clarification.
To answer you question, I do know what..
>document.getElementById("idhere").innerHTML = variable.value
..does. I already explained it in my post. But course, instead of answering my question, you saw it as an opportunity to flex your tiny E-peen and nitpick.
Just for the record, in the this hours that have passed since I posted this question, I've already moved beyond it.
So thanks for showing your stuff, /g/. You never cease to amaze us.
>My question is, is it at all possible to take the value from an existing document element and input it into a variable?
yes, why wouldn't it be possible?
var pinkelephants = document.getElementById("idhere").innerHTML
>>55602934
Thanks.