Jquery
function updateTextArea() {
var allVals = [];
$('#c_b :checked').each(function() {
allVals.push($(this).val());
});
$('#textarea').val(allVals)
$('#div').append(allVals)
}
Why textarea success show the output but div fail to show the output?
Because you can’t append an
arrayvariable to an element and expect a string to be added as the content of the element without giving it string content to append. Use this instead:http://jsfiddle.net/userdude/LWU8y/