jQuery/Javascript: Defining a global variable within a function?
global, javascript, jquery, variables
Solution
Remove the `var` from inside the function.
$("#ma1").click(function() {
one = 1;
})
Problem
I have this code: ``` var one; $("#ma1").click(function() { var one = 1; }) $("body").click(function() { $('#status').html("This is 'one': "+one); }) ``` and when I click the body, it says: This is 'one': undefined. How can I define a global variable to be used in another function?