Tagged: javascript, php
Hi Enfold,
Your theme is very flexible in creating good looking pages. I do have a question but wasn’t able to find proper answer by searching the forum.
If there a possible way to execute a javascript/PHP when the “Contact Form” of a page got executed?
i.e I used the “Contact Form” element of the advance layout you provide. Then what I need is to get the inputs (name, email fields) and execute a javascript/PHP code?
Then pass the values to Mixpanel.
https://mixpanel.com/help/reference/javascript-full-api-reference
https://mixpanel.com/help/reference/php
Please reply soon as possible.
Regards
Roshan
Hi Roshan!
Thank you for using Enfold.
You can use this filter to add an onclick attribute to the contact form’s submit button: https://kriesi.at/support/topic/support-request/#post-401071
Or create a custom script in the functions.php file:
add_action('wp_footer', 'get_value_mod', 10);
function get_value_mod(){
?>
<script>
(function($) {
$('input[type="submit"]').on('click', function(event) {
function get_value() {
var email = $('#avia_e-mail_1').val(),
name = $('#avia_name_1').val();
alert(name + ' : ' + email);
}
get_value();
});
}(jQuery));
</script>
<?php
}
Cheers!
Ismael