Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 22nd, 2012  |  syntax: None  |  size: 1.82 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Passing a Value into a jQuery UI Dialog Box with a Function
  2. $(document).ready(function() {
  3.   $("#dialogbox").dialog({
  4.         open: function(event, ui) {$("a.ui-dialog-titlebar-close").remove();},
  5.         bgiframe: true,autoOpen: false,closeOnEscape: false,draggable: false,
  6.         show: "drop",hide: "drop",zIndex: 10000,modal: true,
  7.         buttons: {'Ok': function() {$(this).dialog("close");processEmp();}}
  8.   });
  9. });
  10.        
  11. function test(pEmp)
  12. {
  13.   var a = pEmp.value);
  14.  
  15.   $('#dialogbox').dialog('open');
  16. }
  17.        
  18. $(function () {
  19.      $("#dialog").dialog({
  20.           open: function (event, ui) { $("a.ui-dialog-titlebar-close").remove(); },
  21.           bgiframe: true,
  22.           autoOpen: false,
  23.           closeOnEscape: false,
  24.           draggable: false,
  25.           show: "drop",
  26.           hide: "drop",
  27.           zIndex: 10000,
  28.           modal: true,
  29.           buttons: { 'Ok': function () {
  30.                $(this).dialog("close");
  31.                processEmp($(this).data("pEmpValue"));
  32.           }
  33.           }
  34.      });
  35. });
  36.  
  37. function processEmp(a) {
  38.      alert(a);
  39. }
  40.  
  41. function test(pEmp) {
  42.      $("#dialog").data("pEmpValue", pEmp.value).dialog("open");
  43. }
  44.        
  45. var a = null;
  46.  
  47. $(function () {
  48.      $("#dialog").dialog({
  49.           open: function (event, ui) { $("a.ui-dialog-titlebar-close").remove(); },
  50.           bgiframe: true,
  51.           autoOpen: false,
  52.           closeOnEscape: false,
  53.           draggable: false,
  54.           show: "drop",
  55.           hide: "drop",
  56.           zIndex: 10000,
  57.           modal: true,
  58.           buttons: { 'Ok': function () {
  59.                $(this).dialog("close");
  60.                processEmp(a);
  61.           }
  62.           }
  63.      });
  64. });
  65.  
  66. function processEmp(a) {
  67.      alert(a);
  68. }
  69.  
  70. function test(pEmp) {
  71.      a = pEmp.value;
  72.      $("#dialog").dialog("open");
  73. }
  74.        
  75. $("#dialogbox").bind("dialogclose", function(event, ui) { processEmp(a); });