I've always had a habit of checking if a certain element exists before telling jquery to do anything with it, just to be thorough. But it doesn't generate an error if I just try to attach my miscellaneous code to an element that happens to not exist, so should I bother checking first? Could it actually slow down the code to do lots of these checks, vs just attempting to set up the behavior regardless?
For example on product pages I have a particular jquery file that runs, and handles all the behaviors for various products. But not all products have the same features, so I don't always need to set up every behavior, so I check beforehand.