如何将.delegate方法应用于此行的jquery?jquery委托方法应用程序
$(function() {
$("input[type='checkbox']").on('change', function() {
if (this.checked) {
$(".loadingItems").fadeIn(300);
var color = encodeURI(this.value);
$(".indexMain").load('indexMain.php?color=' + color, function() {
$(".indexMain").fadeIn(slow);
});
$(".loadingItems").fadeOut(300);
} else {
$(".loadingItems").fadeIn(300);
$(".indexMain").load('indexMain.php', function() {
$(".loadingItems").fadeOut(300);
});
}
});
});
形式:
echo "<input type='checkbox' class='regularCheckbox' name='color[]' value='".$colorBoxes[color_base1]."' /><font class='similarItemsText'> ".$colorBoxes[color_base1]."</font><br />";
PHP接收颜色:
$color = $_GET['color'];
$items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1");
$items -> bindValue(":colorbase1", $color);
while($info = $items->fetch(PDO::FETCH_ASSOC))
{ ....
我需要允许设置一个复选框多项选择。
你试图解决你目前的代码没有解决什么问题?你为什么要使用'.delegate()'? – jfriend00 2012-08-12 19:33:58
试图允许多选...当前选择复选框时我得到我的第一个内容,然后检查另一个框不结合框的结果1和2 ...只显示2 – samyb8 2012-08-12 21:16:39
你必须告诉我们代码在您的更改处理程序。这显然是问题所在。 – jfriend00 2012-08-12 21:20:04