Sometimes when we calculate an indefinite integral in class we insert a function into $dx$, we always insert the primitive of the function into dx. ($f'(x)dx=d(f(x))$)
A simple example is:
$\int {\cot xdx} = \int {\frac{{\cos x}}{{\sin x}}dx} = \int {\frac{{d\left( {\sin x} \right)}}{{\sin x}}} = \left[ {t = \sin x} \right] = \int {\frac{{dt}}{t}} = - \frac{1}{{{t^2}}}+C = - \frac{1}{{{{\sin }^2}\left( x \right)}}+C$
I'm not sure I understand the meaning of doing such a thing? Can it always be done? I would like to understand $dx$ once and for all.
The reason this works and is not just a trick, but formally correct, is that you can think of $d$ as being the exterior derivative operator. The way $d$ works on a differentiable function of one variable is just as you have written, $d(f(x))=\frac{df}{dx} \cdot$dx