Это то, что вы ищете? Когда вы нажимаете флажки, он показывает выбранные значения вверху. когда вы отправляете форму, она показывает вам то же значение в предупреждении
<div id="buffer" style="height:2em; border:1px solid black; margin-bottom:1em"></div>
form action = "#" method = "get">
input type = "checkbox" id = "j" name = "state" value = "state"> state
input type = "checkbox" name = "city" value = "city"> city
input type = "checkbox" name = "type" value = "type"> type
input type = "submit" value = "click me">
/ Форма>
$().ready(function(){
//just a simple demo, you could filter the page by the value of the checkbox
$('form input:checkbox').bind('click',function(){
if($(this).attr('checked')==false){
//remove it from the query string
var pieces=$('#buffer').text().split('/');
var $this_val=$(this).val();
for(var i=0;i<pieces.length-1;i++){
//console.log($(this).val());
//console.log(pieces[i]);
if(pieces[i]==$this_val){
//remove value from the buffer
pieces.splice(i);
}
$('#buffer').text(pieces.join('/')+'/');
}
}else{
//add the value to the query string
$('#buffer').append($(this).val()+'/');
}
});
//on form submit
$('#filterWrapper form').submit(function(){
var queryString='';
$.each($('form input:checkbox:checked'),function(){
queryString+=$(this).val()+'/';
});
alert('this will get send over: '+queryString);
return false;//remove this in production
});
Извините за неработающий HTML, редактору не нравятся теги форм и теги ввода