At first sight everything seems correct.
Just a couple of questions:

Which browser are you using? Does the problem arise on different browsers?

You talk about "popups" but I see in the code...