Costin you are wonderful. And yes, the previous code worked, but (as we both indicated) only after two clicks. Thanks for the cleaned up code.
Though the initial problem remains: href="#" still refers to the top of the page. Any idea why...? (More evident in the second example.)