如何將.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