A function \( f: A \to B \) is said to be onto (or surjective) if for every element \( b \in B \), there exists an element \( a \in A \) such that \( f(a) = b \). This means that the image of \( A \) under the function \( f \) must cover the entire set \( B \).
Hence, for \( f \) to be onto, the condition is:
\[
f(A) = B
\]
This means the range of the function \( f \) is exactly equal to \( B \), which corresponds to option (B).