I am struggling on how to organise my jquery code.
I have the following functions:
function Function1() {
$('a').not('a.dialog').click(function(event){
// Do something.
});
};
function Function2() {
$('a.dialog').click(function () {
// Do something.
});
};
Function1 is called on every page, function2 is called only on a single page.
What is the best way to remove the duplication between these two functions specifically the reference to 'a.dialog'.
Should I be using global variables? or is the above code the best I can hope for?
------------------ UPDATE ------------------
The specifics of the two functions are as follows:
Function1 does this: iPhone Safari Web App opens links in new window
Function2 opens a dialog lightbox.