split into jQuery and vanilla js versions