Avoid javascript memory leaks on web page

move html out of JS into html page. use on click instead of attaching
event listeners that never get destroyed.
BUGZID:24621