Added script doesn't work

71 Views Asked by At

I have a problem with an added script to my Jotform form. The page with the form and the script is here: http://kucanskiposlovi.com/narucite-dolazak/

I added a small script in my source code that checks the paypal checkbox (on the right), when a radio button on the left is clicked. Script works, checkboxes are filled when radio button is clicked, but the total calculation of paypal for some reason doesn't work. It states 0 euros, but when I uncheck and click on the checkbox directly, the total then works.

You can see the Jotform code here: https://form.jotformeu.com/61203206094343

The script I added is:

jQuery(document).ready(function() {
  function subscribe() {
    jQuery('input[type="radio"]').click(function() {
      var trimj = document.getElementById("input_52_0");
      var sestmj = document.getElementById("input_52_1");
      var jednokratno = document.getElementById("input_52_2");
      if (trimj.checked == true) {
        //check 3 mjeseca box, uncheck all other boxes
        jQuery("#input_63_1020").prop("checked", true);
        jQuery("#input_63_1021").prop("checked", false);
        jQuery("#input_63_1022").prop("checked", false);
        jQuery("#input_63_1023").prop("checked", false);
        jQuery("#input_63_1024").prop("checked", false);
        jQuery("#input_63_1025").prop("checked", false);
        jQuery("#input_63_1026").prop("checked", false);
        jQuery("#input_63_1027").prop("checked", false);
        jQuery("#input_63_1028").prop("checked", false);
        jQuery("#input_63_1029").prop("checked", false);
        jQuery("#input_63_1030").prop("checked", false);
      } else if (sestmj.checked == true) {
        //check 6 mjeseci box, uncheck all other boxes
        jQuery("#input_63_1020").prop("checked", false);
        jQuery("#input_63_1021").prop("checked", true);
        jQuery("#input_63_1022").prop("checked", false);
        jQuery("#input_63_1023").prop("checked", false);
        jQuery("#input_63_1024").prop("checked", false);
        jQuery("#input_63_1025").prop("checked", false);
        jQuery("#input_63_1026").prop("checked", false);
        jQuery("#input_63_1027").prop("checked", false);
        jQuery("#input_63_1028").prop("checked", false);
        jQuery("#input_63_1029").prop("checked", false);
        jQuery("#input_63_1030").prop("checked", false);
      }
    });
  }
  subscribe();
});
0

There are 0 best solutions below