使用jquery切换复选框属性

时间:2012-02-26 00:30:03

标签: javascript jquery

  

可能重复:
  Click Toggle with jQuery

我试了一个小时来切换一个复选框。尝试了一切,但我不能让这个工作。

$('#edit-customer-profile-shipping .fieldset-title').click(function() {
    if ($('#edit-customer-profile-shipping input.toggler').is(':checked')) {
        $('#edit-customer-profile-shipping input.toggler').attr('checked', false);
    } else {
        $('#edit-customer-profile-shipping input.toggler').attr('checked', true);
    };
});

有人可以帮帮我吗?

0 个答案:

没有答案