jQuery Dialog with Known Caller


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



Copy this code and paste it in your HTML
  1. $(function(){
  2. // jQuery UI Dialog
  3. $('#dialog').dialog({
  4. autoOpen: false,
  5. width: 400,
  6. modal: true,
  7. resizable: false,
  8. buttons: {
  9. "Confirm": function() {
  10. // submit the form that called the dialog :s
  11. document.forms["vote_campaign_edit"].submit();
  12. },
  13. "Cancel": function() {
  14. $(this).dialog("close");
  15. }
  16. }
  17. });
  18.  
  19. $('form#vote_campaign_edit').submit(function(){
  20. $('#dialog').dialog('open');
  21. return false;
  22. });
  23.  
  24. $('form.formtastic.vote_shop').submit(function(){
  25. $('#dialog').dialog('open');
  26. return false;
  27. })
  28. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.