Molybdenum disulfide (MoS2) has gained attention because of its high mobility and circular dichroism. As a crucial step to merge these advantages into a single device, we present a method that electronically controls and locates p-n junctions in liquid-gated ambipolar MoS2 transistors. A bias-independent p-n junction was formed, and it displayed rectifying I-V characteristics. This p-n diode could perform a crucial role in the development of optoelectronic valleytronic devices.