jquery経由で属性を削除したとき、もう一度アットを追加できません
-
24-10-2019 - |
質問
これは私のコードです:
$("input[name=donationmode]").change(function() {
$(".setpaymentOptions").children().addClass("fadeout");
$(".setpaymentOptions").children().children(".inputfield").children("input").attr("disabled", "disabled");
$(".option-"+$(this).val()).removeClass("fadeout");
$(".option-"+$(this).val()).children(".inputfield").children("input").removeAttr("disabled");
if($(this).val() == 2)
{
$(".option-2").children(".inputfield").children("#paymentOption").find("input").removeAttr("disabled");
$(".option-2").find(".addPaymentOption").attr("onclick", "addPaymentOption()");
}
else
{
$(".option-2").children(".inputfield").children("#paymentOption").find("input").attr("disabled", "disabled");
$(".option-2").find(".addPaymentOption").removeAttr("onclick");
}
});
入力(3つのラジオボタンのラジオボタングループ)を2に変更すると、.addpaymentoptionにオンクリックが追加されます。次に、入力を3に変更し、OnClickが消えます。それは良い。
今、トリッキーな部分、私が値2で戻ってクリックすると、オンクリックが戻ってこない。
助けてください、バグはどこにありますか?
所属していません StackOverflow