Replaced obsolete href="javascript:code" in favor of modern event listeners