I have some checkboxes and I would like to allow multiple selections, only that after each selection a DIV would loading the content.
Here is my checkbox that comes from a PHP while:
<input type='checkbox' class='regularCheckbox' name='color[]' value='".$colorBoxes[color_base1]."' />
Here is my current Jquery which only allows me 1 checked box:
jQuery(document).ready(function($) {
$("input:checkbox").change(function() {
if($(this).is(':checked'))
{
$(".loadingItems").fadeIn(300); //fade in on change
var color = $(this).val();
$(".indexMain").load('indexMain.php?color='+color,function(){
$(".indexMain").fadeIn(slow);
})
$(".loadingItems").fadeOut(300); //remove when load is complete
}
else
{
$(".indexMain").load('indexMain.php');
}
});
});
You may be better served in your case to use
delegateinstead ofchange:$(document).delegate("input:checkbox", "change", function(evt) { //... });