Assigning DOM elements to variables at the begining?

Assigning DOM elements to variables at the begining?

I'm developing a web app and need to reduce redundancy as much as possible.  Would assigning elements using:
  1. var elem = $('#id');
at the beginning help?  Then I could just call elements using "elem.method" instead of having jQuery recurse through all the elements every time.  I don't know much about how jQuery works underneath.

    • Topic Participants

    • me