Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
158
rated 0 times [  162] [ 4]  / answers: 1 / hits: 38198  / 10 Years ago, fri, may 9, 2014, 12:00:00

In my application I have a button, when the user clicks on the button I want a popup box (not window) to appear with a table populated with information I pass in to it.



I have been looking online and cant seem to find how to do this, or even where to start (use all HTML, use all Javascript, use both HTML and Javascript). Has anyone done something similar to this or know a good starting point for this (e.g. what components to use)?


More From » html

 Answers
22

There's a range of frameworks that'll do the trick for you.



An easy and common one is jQuery Dialog (http://jqueryui.com/dialog/)



A small example, given the html:



<div id=dialog-modal title=Basic modal dialog style=display:none>
<p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p>
</div>

<a href=# id=openDialog>Click me</a>


Assuming you've included jQuery and jQuery dialog on top, add the following javascript:



<script>
$(function() {
$( #openDialog).on(click, function(){
$( #dialog-modal ).dialog({
height: 140,
modal: true
});
$( #dialog-modal ).show();
});
});
</script>

[#71116] Wednesday, May 7, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stefanicarolinat

Total Points: 145
Total Questions: 91
Total Answers: 93

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
stefanicarolinat questions
Mon, Nov 15, 21, 00:00, 3 Years ago
Fri, Apr 16, 21, 00:00, 3 Years ago
Thu, Oct 15, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
;