In a circuit with a solenoid/inductor and a resistor and a battery .
Books say that $\Sigma \Delta V=0$ around a closed loop . That means work done by electrostatic field per unit charge is $0$ around a closed loop .
Now as we go pass through a solenoid $\Delta V= -L\frac{di}{dt}$ . Suppose I take charge $idt$ through it , the work done by me against the field will be $\frac{1}{2}Li^2$.
Then it is said this energy is stored in the magnetic field and not the electrostatic field . Then how are we using the loop law ? When $\Delta V$ across an inductor is actually because of work done by magnetic field but loop hole holds for work done by electrostatic field only .
If there is such a electrostatic field that does the same work as the magnetic field , then $\frac{1}{2}Li^2$ must also be stored in electrostatic field in the conductor .