Pedro Chagas
asked on
JavaScript / Jquery - variables inside functions (global)
Hi E's, I need to know how I can use a variable created inside function and use them out side function.
I have this code:
I try to found in Internet for Global variables but I thing JavaScript don't have.
The best regards, JC
I have this code:
$("#b_ocultar").click(function(){
$("#logo").fadeOut(500);
$("#b_ocultar").fadeOut(500);
$("#cabecalho").delay(500).hide(500);
var ocultar = 1;
});
What I have to do for I can use variable "ocultar" outside the function?I try to found in Internet for Global variables but I thing JavaScript don't have.
The best regards, JC
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
When you declare a global javascript variable as suggested in the accepted solution it is added to the window object anyway:
Open in new window
Regards