Reputation: 99
I want to create a link to a pop-up. My problem is, when I click the button for the first time, it will render a pop-up but, when I click it further, it will open new windows.
I want to make sure that, only one pop-up gets rendered and, prevent opening of new windows when clicked multiple times.
<a class="nav-link" href="visitor.html" target="popup" onclick="window.open('visitor.html','name','width=600,height=600')">Some Text</a>
Upvotes: 0
Views: 2399
Reputation: 362
You are trying to open a new window in two different ways, using anchor ('href') and using JavaScript, which may lead to opening of two different windows. In your case, the JavaScript renders the desired popup whereas, the anchor tag opens the new window.
I suggest removing the anchor tag and use mere JavaScript to solve your issue. Please find the below code for your reference.
<span class="nav-link" onclick="window.open('visitor.html','name','width=600,height=600')">Some Text</span>
Upvotes: 2