In JavaScript how do I target a div created in a function from outside that function?
Pic unrelated
In JavaScript how do I target a div created in a function from outside that function?
Pic unrelated
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
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
How long have you had to do it you ungrateful turd?
Thread is dead because you're not very nice.
Let this be a lesson to you.
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.
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?