JQuery generic dialog example part 2/2


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. $(function() {
  3. // prepare second dialog
  4. $("#second_dialog").dialog({
  5. autoOpen: false,
  6. bgiframe: true,
  7. resizable: true,
  8. height:400,
  9. width: 800,
  10. modal: true,
  11. buttons: {
  12. 'Close': function(){
  13. $(this).dialog('close');
  14. }
  15. }
  16. });
  17. // register click events
  18. $("#open_new_dialog").click(function(){
  19. $("#second_dialog").dialog('open');
  20. });
  21. $("#second_dialog_link").click(function(){
  22. alert("Second dialog link");
  23. });
  24. // register change events
  25. $("#selection").change(function(){
  26. alert($("#selection :selected").val());
  27. });
  28. });
  29. </script>
  30.  
  31. <a id="open_new_dialog">
  32. Open Second Dialog
  33. </a>
  34.  
  35. <div id="second_dialog">
  36. <a id="second_dialog_link">Click me</a>
  37.  
  38. <select id="selection">
  39. <option value="0">first</option>
  40. <option value="1">second</option>
  41. <option value="2">third</option>
  42. </select>
  43. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.