Proof that a continuous function maps connected sets into connected sets

Assume $f(D)\subset U\cup V$ where $U,V$ are open sets in $\Bbb{C}$. $f$ being continuous the inverse image of an open set is an open set and so $f^{-1}(U),\,f^{-1}(V)$ are therefore open sets in $\Bbb{C}$.

Now take $x\in D$, one has $f(x)\in f(D)$ and this means $f(x)\in U$ or $f(x)\in V$ and so $x\in f^{-1}(U)\cup f^{-1}(V)$ and therefore $D\subset f^{-1}(U)\cup f^{-1}(V)$.

But $D$ is connected so it cannot be included in the union of two disjoint open sets and so $\exists a\in f^{-1}(U)\cap f^{-1}(V)$ and thus $f(a)\in U\cap V$. Therefore $U,V$ are not disjoint and $f(D)$ is connected.