I had code where I add some height to the div:
$('#some_id').height($('#some_id').height() + 100);
I was criticized for this by the employer, who said that I should not use the selector twice. I should cache the first time, doing something like:
var el = $('#some_id');
el.height(el.height() + 100);
I assumed that there would be only a small saving if I cached the items selected using id, so I never worried. I'm right?
source
share