make the variable global by defining it out of the scopes
var someVar = '';
$(document).ready(function(){
$("input[type='button']").click(function() {
switch(this.id) {
case 'ClickButtonOne':
someVar = 'something';
break;
case 'ClickButtonTwo':
someVar='something else';
break;
}
$("#someContainer").html(someVar);
});
});
from what i understood (from the question), he wanted to set a variable which is already defined somewhere else. For this, it will have to be global. you can also store it in an HTML element using jquery (.data).
Normally what i do is create a javascript object that will contain relevant data. something like :
var someDataContainer = {
somethingImportant : 5
};
and later on i could refer to it using someDataContainer.somethingImportant