Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to open modal popup using javascript. problem is that i have three diffrent type of modal popup (3 divs) and these three popup open on 3 button respectively. now i want single dyanamic javascript and css that i call these divs .
Posted

It's quite straight forward:
JavaScript
function openPopup(idDiv)
{
    $('#'+idDiv).dialog();
}

And you pass the function on each button respectively:
HTML
<input type="button"  önclick="openPopup('div1')" value="btn1" />
<input type="button" onclick="openPopup('div2')" value="btn2" />
<input type="button" onclick="openPopup('div3')" value="btn3" />



Edit:[Nirav Prabtani]

Set $('#'+idDiv).dialog();

instead

$('#idDiv').dialog();
 
Share this answer
 
v2
Comments
Nirav Prabtani 11-Aug-14 5:12am    
my 5+
Trung Nguyen Son 11-Aug-14 5:19am    
Thank you Nirav for correct the code! : )
Hi
you want gridview or click event popup..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900