Search This Blog

Monday, September 4, 2017

Jquery popup window Example


Save the below code as a html file & open with IE or any browser.


HTML & Jquery Code:


<html>
                <head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
         <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<link href="
https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css" rel="stylesheet"/> 
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js">
</script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js">
</script>
<script>
$(document).ready(function(){
var dialog, form;
//dialog.dialog("open");
dialog = $( "#popup" ).dialog({
autoOpen: false,
height: 400,
width: 700,
modal: true,
buttons: {
"Add Company": function(){
alert("Hi alert");
},
Cancel: function() {      
dialog.dialog("close");
}
},
close: function() {
}
});
form = dialog.find( "form" ).on( "submit", function( event ) {
event.preventDefault();
});
$( "#popupBtn" ).button().on( "click", function() {
dialog.dialog("open");
//var success = mdlLoadCountries();
});
});           
                                
</script>
                </head>
                
                
                <body>
<input type="button" id="popupBtn" value="Click Me"></input>
<div id="popup" title="Title of popup">
<table id="tblData" style="width:100%">
  <thead>
<tr>
  <th>FirstName</th>
  <th>LastName</th>
  <th>Age</th>
</tr>
  </thead>
  <tbody>
<tr>
  <td>Jill</td>
  <td>Smith</td>
  <td>50</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
<tr>
  <td>Eve</td>
  <td>Jackson</td>
  <td>94</td>
</tr>
  </tbody>
</table>
</div>
</body>
</html>

No comments:

Post a Comment