KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having a lot of elements which are generated and referenced (mouseover, clicks, position changes) a lot of times. I have the ID's of those elements at hand. Is it wise to store the document.getElementById(ID) calls in a variable, or is it faster/just as fast/slower to call document.getElementById() everytime? var app = []; var app.elements = []; //i can store ['id1', 'id2', 'id3'] //OR ['id1' => document.getElementById('id1'), 'id2' => document.getElementById('id2'), 'id3' => document.getElementById('id3')]
Tags (comma-separated)
Save Edits
Cancel