Shorthand Javascript & jQuery
I always like use short, swift script lines especially when working with the jQuery object.
$(‘#id’)[doShow ? ‘show’ : ‘hide’]();
Is the same and still just as readable as:
var e = $(‘#id’);
if(doShow)
e.show();
else
e.hide();
You could of course use a toggle() concept in this case but you get the idea.
Wednesday Mar 30th