Use getElementsByTagName to switch between edit/preview panes