[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Javascript DOM element output question..
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 5
Thread images: 1
File: 1468128017349.jpg (22 KB, 370x241) Image search: [Google]
1468128017349.jpg
22 KB, 370x241
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 what
document.getElementById("idhere").innerHTML = variable.value
does?
>>
>>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.
Thread replies: 5
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.