Title: Conflict with javascript code
Last modified: February 5, 2021

---

# Conflict with javascript code

 *  Resolved [maucgb](https://wordpress.org/support/users/maucgb/)
 * (@maucgb)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/conflict-with-javascript-code/)
 * I have inserted a reCAPTCHA on my custom html form and it works fine. However,
   when i added the following jquery code to validate that the email field and confirm
   email field match (which works as well) it over rides the reCAPTCHA and enables
   the submit button before the reCAPTCHA is completed. Any ideas would be hugely
   appreciated, many thanks
 *  jQuery(document).ready(function($) {
 *  $(document).ready(function(){
    var $submitBtn = $(“#regform button[type=’submit’]”);
   var $emailBox = $(“#email”); var $confirmBox = $(“#confirmemail”); var $errorMsg
   = $(‘<span id=”error_msg”>Emails do not match.</span>’);
 *  // This is incase the user hits refresh – some browsers will maintain
    the disabled
   state of the button. $submitBtn.removeAttr(“disabled”);
 *  function checkMatchingEmails(){
    if($confirmBox.val() != “” && $emailBox.val!
   = “”){ if( $confirmBox.val() != $emailBox.val() ){ $submitBtn.attr(“disabled”,“
   disabled”); $errorMsg.insertAfter($confirmBox); } } }
 *  function resetEmailError(){
    $submitBtn.removeAttr(“disabled”); var $errorCont
   = $(“#error_msg”); if($errorCont.length > 0){ $errorCont.remove(); } }
 *  $(“#confirmemail, #email”)
    .on(“keydown”, function(e){ /* only check when the
   tab or enter keys are pressed * to prevent the method from being called needlessly*/
   if(e.keyCode == 13 || e.keyCode == 9) { checkMatchingEmails(); } }) .on(“blur”,
   function(){ // also check when the element looses focus (clicks somewhere else)
   checkMatchingEmails(); }) .on(“focus”, function(){ // reset the error message
   when they go to make a change resetEmailError(); })
 *  });
    });

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [bestwebsoft](https://wordpress.org/support/users/bestwebsoft/)
 * (@bestwebsoft)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/conflict-with-javascript-code/#post-14074914)
 * Hi,
 * To add reCaptcha field to custom form, please follow the instruction: [https://support.bestwebsoft.com/hc/en-us/articles/202352499](https://support.bestwebsoft.com/hc/en-us/articles/202352499)
 * We can help you with this task if you need this done. Our specialist is able 
   to investigate your 3rd party plugin and make the required changes. If you’d 
   like, you can request a paid customization and provide all the details in a private
   ticker here: [https://support.bestwebsoft.com/hc/en-us/requests/new](https://support.bestwebsoft.com/hc/en-us/requests/new)
 *  [georgesupport](https://wordpress.org/support/users/georgesupport/)
 * (@georgesupport)
 * [5 years ago](https://wordpress.org/support/topic/conflict-with-javascript-code/#post-14502869)
 * Hi,
 * Since there is no reply from you, we consider this topic as resolved. We hope
   you’ve found the solution. If you have any questions, please feel free to contact
   us via our Help Center – [https://support.bestwebsoft.com/](https://support.bestwebsoft.com/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conflict with javascript code’ is closed to new replies.

 * ![](https://ps.w.org/google-captcha/assets/icon-256x256.gif?rev=2565249)
 * [reCaptcha by BestWebSoft](https://wordpress.org/plugins/google-captcha/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-captcha/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-captcha/)
 * [Active Topics](https://wordpress.org/support/plugin/google-captcha/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-captcha/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-captcha/reviews/)

## Tags

 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [reCAPTCHA](https://wordpress.org/support/topic-tag/recaptcha/)

 * 2 replies
 * 3 participants
 * Last reply from: [georgesupport](https://wordpress.org/support/users/georgesupport/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/conflict-with-javascript-code/#post-14502869)
 * Status: resolved