Ideals are closed under gcd: $\,a,b\in I\,\Rightarrow\, I\supseteq (a,b) = (\gcd(a,b)).$ Thus an ideal $I\ne 0\,$ is generated by any $\,0\neq a\in I$ with least #prime factors (else $\,a\nmid b\in I\,\Rightarrow\, \gcd(a,b)\in I$ and, being a proper factor of $\,a,\,$ it has fewer prime factors than $\,a,\,$ contra choice of $a).$
Remark $\ $ The descent used above is a generalization of the Euclidean descent (by division algorithm) in the classical proof that Euclidean domains are PIDs. More generally we have the Dedekind-Hasse criterion:
a domain $\rm\,D\,$ is a PID $\iff$ given $\rm\:0\neq a, b \in D,\:$
either $\rm\:a\:|\:b\:$ or some D-linear combination $\rm\:a\,d+b\,c\:$ is "smaller" than $\rm\,a\,$ (using $\,\Bbb N\,$ or any well-ordered set for "size")
It is clear that such a domain must be PID (since then
the "smallest" element in an ideal must divide all others).
Conversely, since a PID is UFD, an adequate "smaller" metric is
the number of prime factors (if $\rm\,a\nmid b\:$ then their gcd $\rm\,c\,$
must have fewer prime factors; for if $\rm\:(a,b) = (c)\:$ then
$\rm\,c\:|\:a\:$ properly, else $\rm\,a\:|\:c\:|\:b\:$ contra hypothesis).
More generally it is easy to show a domain $D$ is a PID $\iff D$ is Bezout with ACCP (Ascending Chain Condition on Principal ideals, i.e. the divisibility relations is well-founded, i.e. there are no infinite descending divisibility chains $\,\ldots\, d_3\mid d_2\mid d_1$).