<script>
$(":checkbox").click(function () {
var str = "";
$("input:checked").each(function () {
str += ($(this).val()) + " ";
});
$("div").text(str);
})
.click();
</script>
div { color:red; }
</style>
why does not work? I added the last nell’head jquery but I do not print anything
thanks you
Works fine for me in FF, chrome and IE 7-9. I’ve never had problems using change() on a checkbox
http://jsfiddle.net/c2fE9/
Selectors could probably be optimized, but that won’t stop code working