mylink (the button's this) isn't a string, so you try to open mylink.href:

if (typeof(mylink) == 'string')
  href = mylink;
else 
  href = mylink.href;

But buttons don't have href properties, so it's as if you wrote:

window.open(undefined, 'about', 'width=400,height=200,scrollbars=yes');

which opens a blank page, as expected. If you want to open the same page as the link, use:

onclick="popup('newpopup.html', 'about');"
Answer from Paul Roub on Stack Overflow
🌐
C# Corner
c-sharpcorner.com › blogs › open-popup-on-button-click-using-jquery1
Open PopUp on Button Click Using JQUERY
September 30, 2014 - This blog give the information like how generate popup window on button click using the jquery.
Discussions

html - How can I open a popup window using JQuery? - Stack Overflow
I have this sample: https://jsfiddle.net/bac8qdq1/ HTML: Click here to open dialog test More on stackoverflow.com
🌐 stackoverflow.com
Display a Modal on button click using Jquery
I want to display my Modal on button click. Below is my code. <... More on stackoverflow.com
🌐 stackoverflow.com
popup - How to make a pop up appear when you click a button in html - Stack Overflow
I need help with this and because I've been researching the internet and I found nothing good, so I'm trying to make a pop up when a user clicks a button. This is the code I found but did not work:... More on stackoverflow.com
🌐 stackoverflow.com
open popup window in button click event without using jquery
Please any one tell me how to open popup window by button click event without using jquery in asp.net C#. More on c-sharpcorner.com
🌐 c-sharpcorner.com
4
January 5, 2018
🌐
WpPopupMaker
wppopupmaker.com › docs › triggering-popups › trigger-click-open-use-jquery-to-trigger-a-popup-on-click
Use Inline JavaScript And JQuery To Trigger A Popup With A Click - Popup Maker
March 25, 2025 - // The parameter '123' in the .open() method refers to a generic popup ID number. // Substitute the actual ID number generated for your popup. <script type="type/javascript">jQuery('#my-button').on('click', function () { PUM.open(123); }); </script>
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-a-popup-on-click-using-javascript
How to Open a Popup on Click using JavaScript ? - GeeksforGeeks
August 5, 2025 - In this approach, we will use the classList property with toggle() method in JavaScript to toggle the visibility of the overlay and popup dialog elements. The openFn() function dynamically adds or removes the 'hidden' class, while adjusting ...
🌐
C# Corner
c-sharpcorner.com › blogs › javascriptopen-new-popup-window-on-button-click-event1
Javascript-Open new Popup Window on button click event
April 29, 2020 - window.open(MyPath,"","toolbar=no,status=no,menubar=no,location=center,scrollbars=no,resizable=no,height=500,width=657");
🌐
YouTube
youtube.com › watch
Show jQuery UI Modal Popup Window on Button Click with Example - YouTube
Here I will explain show simple jQuery ui modal popup window on button click with example or creating modal popup window using jQuery ui plugin modal popup f...
Published   July 23, 2025
Views   73K
Find elsewhere
🌐
John Kavanagh
johnkavanagh.co.uk › home › articles › a simple popup window using jquery
A Simple Popup Window Using jQuery, by John Kavanagh
May 28, 2025 - Making a popup window with jQuery ... is clicked upon: $('#link').click(function (e) { e.preventDefault(); var url = $(this).attr('href'); window.open(url, 'popup', 'width=600,height=600'); return false;});...
🌐
Pair Networks
pair.com › home › using jquery to generate modal pop-up when clicked
jQuery Modal Popup | jQuery Modal Example | jQuery Popup
May 21, 2025 - This second statement removes the “active” class when the “Close” button is clicked. $(".close, .popup").on("click", function(){ $(".popup, .popup-content").removeClass("active"); }); When this happens, the “active” class is removed from the pop-up classes, causing them to revert to their previous styling that has the visibility set to hidden. Add both statements of jQuery to your document. If all this is completed correctly, you will have a rudimentary modal pop-up box. jQuery is an open-source software permissive under an MIT license.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-generate-a-simple-popup-using-jquery
How to generate a simple popup using jQuery ? | GeeksforGeeks
February 17, 2026 - Example: In this example we creates a jQuery UI dialog popup that remains hidden by default. It opens when the "Show Popup" button is clicked, using the dialog() method to display the popup content.
🌐
ASPSnippets
aspsnippets.com › Articles › Open-Show-jQuery-UI-Dialog-Modal-Popup-on-Button-Click.aspx
Open (Show) jQuery UI Dialog Modal Popup on Button Click
August 26, 2015 - explained with an example, how to Open (Show) jQuery UI Dialog Modal Popup box on Button Click. The jQuery UI Dialog Modal Popup box will be shown (opened) on Button Click using the jQuery Dialog “open” command.
Top answer
1 of 4
11

show openModal div on button1 click.

$('#button1').on('click', function() {
    $('#openModal').show();
});

No need of onclick="myFunction()" on button

2 of 4
3

Let's try...

Simple popup model created by using jquery, HTML, and CSS.

$(function() {
    // Open Popup
    $('[popup-open]').on('click', function() {
        var popup_name = $(this).attr('popup-open');
 $('[popup-name="' + popup_name + '"]').fadeIn(300);
    });
 
    // Close Popup
    $('[popup-close]').on('click', function() {
 var popup_name = $(this).attr('popup-close');
 $('[popup-name="' + popup_name + '"]').fadeOut(300);
    });
 
    // Close Popup When Click Outside
    $('.popup').on('click', function() {
 var popup_name = $(this).find('[popup-close]').attr('popup-close');
 $('[popup-name="' + popup_name + '"]').fadeOut(300);
    }).children().click(function() {
 return false;
    });
 
});
body {
    font-family:Arial, Helvetica, sans-serif;
}
 
p {
    font-size: 16px;
    line-height: 26px;
    letter-spacing: 0.5px;
    color: #484848;
}
 
/* Popup Open button */ 
.open-button{
    color:#FFF;
    background:#0066CC;
    padding:10px;
    text-decoration:none;
    border:1px solid #0157ad;
    border-radius:3px;
}
 
.open-button:hover{
    background:#01478e;
}
 
.popup {
    position:fixed;
    top:0px;
    left:0px;
    background:rgba(0,0,0,0.75);
    width:100%;
    height:100%;
    display:none;
}
 
/* Popup inner div */
.popup-content {
    width: 500px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 40px;
    margin-top: 20px;
    box-shadow: 0px 2px 6px rgba(0,0,0,1);
    border-radius: 3px;
    background: #fff;
    position: relative;
}
 
/* Popup close button */
.close-button {
    width: 25px;
    height: 25px;
    position: absolute;
    top: -10px;
    right: -10px;
    border-radius: 20px;
    background: rgba(0,0,0,0.8);
    font-size: 20px;
    text-align: center;
    color: #fff;
    text-decoration:none;
}
 
.close-button:hover {
    background: rgba(0,0,0,1);
}
 
@media screen and (max-width: 720px) {
.popup-content {
    width:90%;
    } 
}
<!DOCTYPE html>
<html>
<head>
 <title> Popup </title>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head> 

<body>
    <a class="open-button" popup-open="popup-1" href="javascript:void(0)"> Popup 
        Preview</a>
         
        <div class="popup" popup-name="popup-1">
            <div class="popup-content">
            <h2>Model </h2>
        <p>Model content will be here. Lorem ipsum dolor sit amet, 
        consectetur adipiscing elit. Aliquam consequat diam ut tortor 
        dignissim, vel accumsan libero venenatis. Nunc pretium volutpat 
        convallis. Integer at metus eget neque hendrerit vestibulum. 
        Aenean vel mattis purus. Fusce condimentum auctor tellus eget 
        ullamcorper. Vestibulum sagittis pharetra tellus mollis vestibulum. 
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        <a class="close-button" popup-close="popup-1" href="javascript:void(0)">x</a>
            </div>
        </div>  
</body>
</html>

🌐
Aspdotnet-suresh
aspdotnet-suresh.com › 2014 › 05 › jquery-display-popup-window-on-button-click-in-asp-net.html
jQuery - How to Display Popup Window on Button Click in Asp.net
Here I will explain how to display popup window on button click in asp.net using jQuery ui modal popup window or open jQuery modal popup window on button click in asp.net.
🌐
W3Schools
w3schools.com › howto › howto_js_popup.asp
How To Create Popups
Learn how to create popups with CSS and JavaScript. Click me to toggle the popup!
🌐
Tutorialdeep
tutorialdeep.com › knowhow › jquery faqs › open bootstrap modal popup on button click using jquery
Open Bootstrap Modal Popup on Button Click Using jQuery
September 24, 2024 - To open Bootstrap modal on button click, you have to use the jQuery modal('show'). You can can also display Bootstrap modal when someone
Top answer
1 of 4
1
You can use Javascript to open a popup window in asp.net. Try with below sample implementation First Move the code inside your div to a new page and call its as Popup.aspx. Popup.aspx Code "http://www.w3.org/1999/xhtml" > "server" > "form1" runat= "server" > "_lname" runat= "server" > "Button1" runat= "server" Text= "save" OnClick= "Button1_Click" /> You will have the click event for button also in code behind of Popup.aspx Now from your main page use below code to open popup window function openPopupWindow() { //Open the popup page window.open( 'Popup.aspx' , 'pagename' , 'resizable=no,width=200,height=400' ); } Call the javascript function in your button click like below asp:Button ID = "btnOpenPopupWindow" runat = "server" Text = "Open Popup Window" OnClientClick = "openPopupWindow();return false;" />
2 of 4
0
you can try the bellow > html > head > style > /* Popup container - can be anything you want */ .popup { position: relative; display: inline-block; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* The actual popup */ .popup .popuptext { visibility: hidden; width: 160px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 8px 0; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -80px; } /* Popup arrow */ .popup .popuptext::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } /* Toggle this class - hide and show the popup */ .popup .show { visibility: visible; -webkit-animation: fadeIn 1s; animation: fadeIn 1s; } /* Add animation (fade in the popup) */ @-webkit-keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} } @keyframes fadeIn { from {opacity: 0;} to {opacity:1 ;} } style > head > body style = "text-align:center" > h2 > Popup h2 > div class = "popup" onclick = "myFunction()" > Click me to toggle the popup! span class = "popuptext" id = "myPopup" > A Simple Popup! span > div > script > // When the user clicks on div, open the popup function myFunction() { var popup = document .getElementById("myPopup"); popup.classList.toggle("show"); } script > body > html >
🌐
Udemy
blog.udemy.com › home › how to create jquery popup windows with the dialog() widget
How To Create jQuery Popup Windows With The dialog() Widget - Udemy Blog
May 22, 2017 - We place the “open” operation inside the button’s click() method’s function, so we’ll only open the dialog box after the user clicks on the button: $( "#say_it" ).click(function() { $( "#hello" ).dialog( "open" ); }); Can we customize ...