$(document).ready(function() {
var x = "";
$("#anyElement").click(function() {
x = "test";
alert(x);
});
alert(x);
});
When first alert works, messagebox shows "test". when second alert works, messagebox shows " ".
$("#anyElement").click(function() {
// How can i set the x veriable as "test" here
});