Button click not firing the capture lead function

gerard_reyes Posted by: Gerard Reyes Date Posted: March 16, 2025
Back to Case Studies

Issue

The submit button is disabled initially so the LMFX capture is not working. Once the submit button is enabled, there is an inline code that takes priority before our code. Our code does not fire because of that resulting in leads not being captured.

Solution

Added a code to fire the LMFX on hover of the mouse to the submit button. This allows us to fire our LMFX capture function before the inline code fires.

<script>
(function() {
     document.addEventListener('mouseover', function(event) {

         if (event.target.tagName === 'BUTTON' && event.target.classList.contains('submit-button')) {
             var my_form = event.target.closest('form');
             mcfx('capture', my_form);
         }
     });
})();
</script>

Achievement

The lead was captured.

Snippet/Screenshot/Link