Advertisement
briank

Force-Style Disabled Kartra Submit

Nov 9th, 2022 (edited)
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.75 KB | None | 0 0
  1. <script>
  2. /*
  3.  * Hack to force Kartra opt-in submit buttons to keep their assigned colors when disabled.
  4.  * This software is provided on an as-is basis. Place in FOOTER tracking and use at your own risk.
  5.  * Brian Katzung <briank@kappacs.com>
  6.  */
  7. $(function () {
  8.     function update () {
  9.         $('.kartra_optin_submit_btn').each(function (ind, el) {
  10.             var want = 'background-color: ' + el.style.backgroundColor + ' !important; color: ' + el.style.color + ' !important; font-weight: ' + el.style.fontWeight;
  11.             if (want !== el.getAttribute('style')) el.setAttribute('style', want);
  12.         });
  13.     }
  14.     update();
  15.     var bmo = new MutationObserver(update);
  16.     bmo.observe(document.body, { childList: true, subtree: true });
  17. });
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement