A function is both one-to-one and onto if you can find a preimage of every element in the codomain.
Now, our domain is
$f(x)=\frac{x}{2x+1} , \, x\not= -\frac{1}{2}$
Now, say we get $y$
$y = \frac{x}{2x+1}$
$y(2x+1) = x$
$2xy + y - x = 0$
$x(2y-1) = -y$
$x = \frac{-y}{2y-1} , \, y\not= \frac{1}{2}$
Thus, if from the codomain of Real numbers, $\frac{1}{2}$ is excluded, for every element in codomain, there will exist a preimage.