If your gas cap has lost its seal you could have water in the gas. Water will sink (see pic below of gas I drained from a tank a few years ago. The little blobs are water). Once your fuel pump sucks it in your bike will stop running.
Bit of a pain to remedy: Remove tank. Take out pump. Drain pump. Squirt some brake cleaner into fuel supply hose to displace the water (brake cleaner will evaporate). If you're feeling lucky put everything back together and hope plugs aren't fouled. Before you reconnect the fuel hose to the pump put a container under the supply nipple and turn bike on a couple times. This will cause fuel in the pump to come out so you can be sure you have pure gas going to the injectors when you put everything back together.
If you're not feeling lucky, pull out the plugs. Clean and dry or replace. They're cheap so if you're anywhere near the replacement interval you may as well.
Or you may have just shot some water into the air intake and down the throttle bodies and it fouled the plugs. Waiting will remedy this usually as they dry out.
I'm assuming the bike cranks. If it doesn't then it's something electrical.