2 Replies Latest reply on Oct 30, 2014 7:20 AM by Josh Hill

    Click unsubscribe and uncheck all checkboxes

      I would greatly appreciate some help to have a checkbox that when clicked unchecks all other checkboxes.

      Has anyone had success with this using Marketo forms 2?

      I've tried adding a form object to my landing page and also tried pulling the form in using the embed form code in an html object. I can't even show an alert with the value of a checkbox, so I'm doing something wrong for sure.

      Here is the code in the html object.

      <script src="//app-abj.marketo.com/js/forms2/js/forms2.js"></script>
      <form id="mktoForm_1211"></form>
      <script>MktoForms2.loadForm("//app-abj.marketo.com", "895-WNT-152", 1211);</script>

      <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
      <script type="text/javascript">
          // use no conflict mode for jQuery
        var $jQ = jQuery.noConflict();

        function unsubscribeAll () {
          $jQ('#form [type="checkbox"]').each(function () {
              $jQ('#form').append('<input name="' + $jQ(this).attr('name') +'" value="0" type="hidden" />');
          }).removeAttr('checked');

      }
      $jQ('#button-unsubscribe').click(function () {
              unsubscribeAll();
          });
      </script>