<div class="myBox">
<input type = "checkbox" id = "Banana" value = "Banana" />
<input type = "checkbox" id = "Orange" value = "Orange" />
<input type = "checkbox" id = "Apple" value = "Apple" />
<input type = "checkbox" id = "Papaya" value = "Papaya" />
<input type = "checkbox" id = "Watermelon" value = "Watermelon" />
<input type = "checkbox" id = "Grape" value = "Grape" />
</div>
<div id="display">
</div>
如何将其存储到数组中并在有人选中复选框时立即将所有复选框选中的值显示到“#display”div中,并在某人未选中复选框时删除该值。例如,当我单击 Banana 时,“#display” div 将显示 Banana,然后我继续单击 Grape,它将显示 Banana, Grape。取消选中复选框时,从“#display”div 中删除单词“Banana”,这样“#display”div 将只显示“Grape”。在jQuery中。
任何帮助将不胜感激。