If you're asking why we set only the numerator equal to 0 and not the denominator, recall that $0$ divided by any nonzero number is $0$. Similarly, any number divided by $0$ is undefined.
Therefore in your case, the fraction is only equal to $0$ when its numerator is equal to $0$ and it's denominator is not equal to $0$, as having a denominator equal to $0$ (which is akin to dividing by $0$) would render the expression undefined.