Contact form7 : Add function on button click
We can call a function on button click when we are using contact form7. This function will call or work whether your form get submitted or not. To do this follow the instructions below :
Add a jQuery to your page which is required to make this code work.
Add a id to the contact form submit button.
After this put this code in your footer.php :
<script type="text/javascript"> jQuery(document).on("click", "#idforsubmit", function(e) { alert("hello");//put your desired code here }); </script>
Where “idforsubmit” is the id of your submit button through contact form7. If you have already added jQuery to the page, just use the above code.
Hi, I want to know how can I put a JS function in the CF7 that when the user put a number less than 5 in the email I receive must be in red and if is higher than 5 is in green? Thanks!