This is should be clear given the definition of a virtual displacement. Let us see that. I borrow this from Lectures on analytical mechanics by F Gantmacher.
Consider a system of particles with position vectors we denoted as $\vec{r_i}$. The system may be subjected to a constraint $f(\vec{r_i},\dot{\vec{r_i}},t)=0$. Let us consider a sub class of constraints $f(\vec{r_i},t)=0$. These constraints are said to be holonomic constraints. Now by differentiating this once, we obtain $$\sum_i\frac{\partial f}{\partial\vec{r_i}}\cdot\vec{v_i}+\frac{\partial f}{\partial t}=0$$
This equation is satisfied by the velocities of the particles. The velocities that obey this equation are said to be allowed velocities. Let us define allowed displacements by $\mathrm d\vec{r_i}=\vec{v_i}~\mathrm dt$. This satisfies, $$\sum_i\frac{\partial f}{\partial\vec{r_i}}\cdot{\mathrm d\vec{r_i}}+\frac{\partial f}{\partial t}~\mathrm dt=0$$We can now define virtual displacements as the difference between two allowed displacements. i.e. $\delta\vec{r_i}=(\vec{v}^\prime_i-\vec{v}_i)~\mathrm dt$. Therefore this satisfies, $$\sum_i\frac{\partial f}{\partial\vec{r_i}}\cdot\delta{\vec{r_i}}=0$$Let us do an example. Consider a simple pendulum with the string length $l$ attached to an oscillating support. Let the coordinates of the bob be $(x,y)$ and let the coordinates of the point of support be given by $(L \cos(\Omega t),0)$. Then the constraint here is $f(x,y,t)=(x-L\cos(\Omega t))^2+y^2-l^2=0$. Then the allowed displacements satisfy $2(x-L\cos(\Omega t)~\mathrm dx+2y~\mathrm dy+2(x-L\cos(\Omega t))L\Omega\sin(\Omega t)~\mathrm dt=0$ whereas the virtual displacements satisfy $2(x-L\cos(\Omega t))~\delta x+2y~\delta y=0$.