In JavaScript how do I target a div created in a function from outside that function?

In JavaScript how do I target a div created in a function from outside that function?

Pic unrelated

Other urls found in this thread:

youtu.be/oXWgJSpvbic
stackoverflow.com/questions/32549747/hide-a-specific-div-element-that-has-been-dynamically-generated
jsfiddle.net/8wpoo910/
mysexywrestlingdivas.freeforums.net/
twitter.com/NSFWRedditVideo

Bamp

Please guys I'm going to fail uni

You're gonna need to tell a bit more about your code than that in order to get an answer.

giv it an id and then getElementById('idname');

could you already have the div in the HTML and have the function replace the div instead of creating it?

that way the second function might 'see' it as it read the page when the DOM loaded

im just guessing tho

I gave it a class and tried to target it with classname[0] but it couldnt register it existing.

We lose 5% for each html element used that is not written purely in JS

youtu.be/oXWgJSpvbic

I think a trip to Stackoverflow is in order

That wasn;t much help and this is due by midnight

There's nothing I could find on it.

this any good? (Jquery tho)
stackoverflow.com/questions/32549747/hide-a-specific-div-element-that-has-been-dynamically-generated

How long have you had to do it you ungrateful turd?

jsfiddle.net/8wpoo910/

Thread is dead because you're not very nice.
Let this be a lesson to you.

>jsfiddle.net/8wpoo910/

You are a godsend. Thank you!

Not sure why I'm not nice but a guy already helped me. Sorry you didn't like the thread though.

mysexywrestlingdivas.freeforums.net/

document.getElementsByClassName("className")[0]

getElementsByClassName returns an array

this is the correct way

time to sage this shit

I got it now, thanks mate

What kind of community college horseshit is that?