5e09ce435de54022c8acd09844bc3eb62c8e33e6
[wolnelektury.git] / src / club / static / club / form.js
1 $(function() {
2
3     function update_methods() {
4         $("#payment-form .payment-method").addClass("disabled");
5         $("#payment-form .payment-method input").prop("disabled", true);
6         var plan = $("#payment-form .plan:checked");
7         if (plan.length) {
8             $.each(
9                 $("#payment-form .plan:checked").attr('data-methods').trim().split(" "),
10                 function(i, slug) {
11                     $("#payment-method-" + slug).removeClass("disabled");
12                     $("#payment-method-" + slug + " input").prop("disabled", false);
13                 }
14             );
15         }
16     }
17     update_methods();
18     $("#payment-form .plan").change(update_methods);
19
20
21     $("#payment-form").submit(function() {
22         _paq.push(['trackGoal', 12, $("#id_amount").val()]);
23     });
24 });