Dropdown within an overlay

So I have an overlay (Overlay A). I have a dropdown overlay that comes up within that overlay (Overlay B). I want to have a selectable item within that menu that replaces the whole Overlay A. How do I do this? I can only get it to replace overlay B, resulting in two overlays.