mardi 11 août 2020

Multiselect checkbox

I'm very new to css and jQuery, I usually live in html, but I'm trying to change some custom css code for a form (FormAssembly) that pulls in data from a Salesforce connection. Currently, if there are multiple options pulled in, it is only possible to select one checkbox. I'm looking at the code to try to see how I could change it to allow selecting multiple and I am stumped. Can anyone point me in the right direction, or where to read up on how to possibly do this? Maybe it's not possible, but even knowing that would be helpful!

This is what I'm working with:

 (function($){
    $( document ).ready( function (  ) {
      var fieldset = '#tfa_2232'; 
      $('input:checkbox', fieldset).each(function(i){
        if (i === 0) {
          $(this).prop('checked', true);
        }
      });
      $('input:checkbox', fieldset).click(function(e){
        $('input:checkbox', fieldset).prop('checked', false);
        $(this).prop('checked', true);
      });
    });
  })(jQuery);

Any advice appreciated!




Aucun commentaire:

Enregistrer un commentaire