1 Replies - 1388 Views - Last Post: 01 November 2012 - 09:51 AM

#1 adn258  Icon User is offline

  • D.I.C Addict

Reputation: 11
  • View blog
  • Posts: 761
  • Joined: 31-August 11

How Do You Call a Common Site Jquery Ui Dialog With One Function?

Posted 21 October 2012 - 03:57 PM

So let's say you have a simple dialog that you use throughout your site for a common error or something. One thing I've noticed about jquery ui is you can't seem to just call it from a function like ErrorDialog(); in a JS file or something somewhere simply because so many of the elements change like if you just want to open a dialog

  $('#dialog').dialog('open');




but that button id may not be dialog next time etc. etc. I'm just wondering if there IS an easy easy way to do this that I don't know about instead of having to re-type a lot of the same code over and over again whilst it can't be called from a common function

Is This A Good Question/Topic? 0
  • +

Replies To: How Do You Call a Common Site Jquery Ui Dialog With One Function?

#2 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: How Do You Call a Common Site Jquery Ui Dialog With One Function?

Posted 01 November 2012 - 09:51 AM

Hello adn258,

Could you provide more insight into the question? If you have created an error dialog DIV called (for examples sake) myErrorDiv, you could call that with ...
$('#myErrorDiv').dialog('open');

... or you could store the object and use it multiple times within the same scope ...
var errorBox = $('#myErrorDiv');
errorBox.dialog('open');


I don't see what the problem is, why would the DIV change it's ID unless you manually did it, if you did, why?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1