js to toggle view & edit mode