Showing val as html inside of a div in real time.
Posted
by smudge
on Stack Overflow
See other posts from Stack Overflow
or by smudge
Published on 2010-05-18T18:32:44Z
Indexed on
2010/05/18
19:10 UTC
Read the original article
Hit count: 141
jQuery
I'm using the following in order to have on screen display of each value of a checkbox that's selected with great results when it's displayed inside a textbox. I'd like to change it so that I can show a real time display in a div as html instead of a textbox.
A link to a working demo is here and below is the script. I know it's probably a basic line or two but i'm still learning and new. thanks!
function updateTextArea() {
var allVals = [];
$('#c_b :checked').each(function() {
allVals.push($(this).val());
});
$('#t').val(allVals)
}
$(function() {
$('#c_b input').click(updateTextArea);
updateTextArea();
});
© Stack Overflow or respective owner