<script>
$('input:checkbox').on('change',function () {
if(this.checked){
var Val = (this.checked ? $(this).val() : "");
var oldVal = $('#idoftextbox').val();
$('#idoftextbox').val(Val+","+oldVal);
}
else{
var Val = $(this).val();
var oldVal = $('#idoftextbox').val();
data = removeValue(oldVal,Val);
$('#activity_level').val(data);
}
});
function removeValue(list, value) {
list = list.split(',');
list.splice(list.indexOf(value), 1);
return list.join(',');
}
</script>
$('input:checkbox').on('change',function () {
if(this.checked){
var Val = (this.checked ? $(this).val() : "");
var oldVal = $('#idoftextbox').val();
$('#idoftextbox').val(Val+","+oldVal);
}
else{
var Val = $(this).val();
var oldVal = $('#idoftextbox').val();
data = removeValue(oldVal,Val);
$('#activity_level').val(data);
}
});
function removeValue(list, value) {
list = list.split(',');
list.splice(list.indexOf(value), 1);
return list.join(',');
}
</script>
No comments:
Post a Comment