$("input[type='button']").click(
function (){
var vals = $(this).val();
alert(vals);
$("input[name='rooms']").val(vals);
}
);
вот html
<input type='button' value='Студия'>
<input type='button' value='1'>
<input type='button' value='2'>
<input type='button' value='3'>
<input type='button' value='4'>
<input type='hidden' class='rooms_val' name='rooms' value=''>