check uncheck All checkboxes with another single checkbox use jquery

后端 未结 10 554
长情又很酷
长情又很酷 2020-12-03 05:14

I use jquery-1.9.1.js In my html page, it works well for the first time.

just like http://jsfiddle.net/pzCcE/1/

Can somebody help me to improve it?

10条回答
  •  忘掉有多难
    2020-12-03 05:53

    $("input[name='select_all_photos']").click(function () {
            var checked = $(this).is(':checked');
            $("input[name^='delete_']").each(function () {
                $(this).prop("checked", checked);
            });
        });
    

    Don't bother doing an if statement.

提交回复
热议问题