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

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