Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'Global' variables in jquery
Message
De
20/12/2012 16:34:28
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01560348
Message ID:
01560350
Vues:
76
This message has been marked as the solution to the initial question of the thread.
>Hi everybody,
>
>I have the following code
>
>
>$("#sform").dialog({
>        autoOpen: false,
>        show: "blind",
>        resizable: true,
>        width: 1200,
>        height: 750
>    });
>    $("#sform").dialog("open");
>
>I want to somehow have the variable dlg defined with all dialog deifnition and use it in several methods in my js script.
>
>What is the correct way to do so in jquery? How and where should I define such variable to be able to use it in several methods? Also, how would I call its open method this way?
>
>Thanks in advance.

Not sure if the following would work. It's my SWAG:

var dlg = null;

function createdlg() {
dlg = $("#sform").dialog({
autoOpen: false,
show: "blind",
resizable: true,
width: 1200,
height: 750
});
}

function mytest() {
dlg.dialog("close");
}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform