I am trying to trigger a function on submit of an embedded form. The form is embedded using javascript. I've tried to target the form with a generic call i.e
$('form').submit(function(){
alert();
});
This is not working. I also tried to target the embedded submit button using $('#submit_button').on('click', function(){});
but does not work either.
Is this possible?
This form is being loaded with this embed snippet.
<!-- SharpSpring Form for XXX -->
<script type="text/javascript">
var ss_form = {'account': 'XXX', 'formID':'XXXX'};
ss_form.width = '100%';
ss_form.height = '1000';
ss_form.domain = 'XXXXXX';
// ss_form.hidden = {'Company': 'XXXX'};
</script>
<script type="text/javascript" src="https://external-form.js?ver=1.1.1"></script>
<script type="text/javascript">
var __ss_noform = __ss_noform || [];
__ss_noform.push(['baseURI', 'https://']);
__ss_noform.push(['endpoint', '00000-000-0O0O0-000-000OOO00O']);
</script>
If I run this JS through the console
$('form').submit(function(){
alert();
});
I will get an alert when submitting the form, It just won't fire the event with that code.