I want to modify a variable which is inside a function in a class. If I move alert to inside the function block it works. But If it stand outside the {} it doesn´t work.
class test {
my_test() {
var var_a = 50;
var var_b;
$("input[name='my_input']").click(function() {
if ($("#radio1").is(":checked")) {
var_b = 100;
} else if ($("#radio2").is(":checked")) {
var_b = 0;
}
});
alert(var_b);
}
}