Posted By


joernroeder on 08/28/10

Tagged


Statistics


Viewed 382 times
Favorited by 0 user(s)

jQuery.getOrCreateDialog


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



Copy this code and paste it in your HTML
  1. $.extend({
  2. /**
  3. * Create DialogBox by ID
  4. *
  5. * @param { String } elementID
  6. */
  7. getOrCreateDialog: function(id) {
  8.  
  9. $box = $('#' + id);
  10. if (!$box.length) {
  11. $box = $('<div id="' + id + '"><p></p></div>').hide().appendTo('body');
  12. }
  13. return $box;
  14. }
  15. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.