function areaMe(area){
var barea = $('#barea').val();
if(barea.indexOf(area)!=-1){
barea=barea.replace(area, ""); // remove
}else{
barea+=area; // inlcui
}
$('#barea').val(barea);
}
It doesn’t work if the #barea input is hidden…
For a hidden input I always use
not val(). I’ve never had luck changing the value of an
input type=hiddenany other way.If
bareaisn’t ainput type=hidden, then you’ll need to include the html for it. Note that it must be some type of input as val() only works on inputs, selects, and textareas.