Download and add to your theme:
http://malsup.github.com/jquery.form.js
Add to your Functions PHP:
wp_enqueue_script("jquery"); wp_enqueue_script( 'jquery-form-js', get_template_directory_uri() . '/js/jquery.form.js', array('jquery'), '3.51.0-2014.06.20', true );
In any SINGLE CRED form JS Editor:
jQuery(document).ready(function() { jQuery('#cred_form_4988_1').ajaxForm(function() { alert("Thank you for your comment!"); }); });
Replace #cred_form_4988_1
with the actual ID of the CRED Form you’ll see in your browser console asa in this:
<form enctype="multipart/form-data" id="cred_form_4988_1" class="cred-form cred-keep-original" action="/toolset/2015/07/08/ajax-edit/?cred-edit-form=4988&_tt=1436396327" method="post">
If you have MULTIPLE CRED FORMS (of same form), outputted in a Views Loop
Means, you got x posts, and therefore x CRED Forms of same type,the ID of CRED is continuously increased by one, so the a above jQuery breaks. You should use here:
jQuery(document).ready(function() { jQuery("[id^=cred_form_1096]").ajaxForm(function() { alert("Thank you for your comment!"); }); });
We use now ("[id^=PART_OF_ID]")
You can also seek for all elements which contain (*=)
or end up with ($=)
known part of ID/class/type.
(example, id^, id*, id$)
DOC Links:
http://malsup.com/jquery/form/#getting-started