If you have to reuse it then assign it to a variable.

var a = $('a');
a.doSometing.
// later
a.doOtherStuff

Is better than

$('a').doSometing.
// later
$('a').doOtherStuff


On Jan 21, 2010, at 7:26 AM, KevinA wrote:

Just wondering whats the best practice performance-wise.

var a = $('myel');

-or-

Do I just use  $('myel') whenever I need it in my code as opposed to
using my 'a' variable.

Any thoughts?


Its a basic question but wondering how much a difference either method
has from the other.

Reply via email to