• Resolved Ronaldt

    (@neejoh)


    When I visit the [Forminator ? Settings] page I get the following error in the developer tools console:

    Uncaught TypeError: $ is not a function at main.js?ver=1.5.4:14

    I’m trying to get reCAPTCHA working but due to this error the example doesn’t work. Above error is shown after adding the site and secret keys created at google.com/recaptcha/admin (V2)

    Can this be ported to jQuery instead of $?

    • This topic was modified 6 years, 3 months ago by Ronaldt.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @neejoh,

    Hope you’re doing well.

    I have tested this on my installation but I couldn’t replicate the issue as I was able to connect my captcha without any issues, here’s how it looks on my end: https://monosnap.com/file/j5XogASJcRbtjqTcZOoPzhVMU8Onvn

    It seems that there’s some conflict on your site that’s causing this.
    Can you temporarily disable your other plugins, switch to default WP theme and then give it another try?
    This should help us pinpoint the cause so we can investigate it further.

    Cheers,
    Predrag

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @neejoh,

    I’m marking this topic as resolved due to recent inactivity. Feel free to post back any update and we can re-open it and carry on troubleshooting! ??

    Thank you,
    Dimitris

    Thread Starter Ronaldt

    (@neejoh)

    Hi guys, sorry for the lack of communication.
    I somehow missed @wpmudev-support1’s reply and then with Christmas came and I wasn’t able to jump into it when @wpmudev-support6 replied.

    Looked into it today and found out that the problem was caused by a 3rd party plugin that used $.noConflict(); directly in the wp_enqueue_scripts hook. When I commented out that line of code, Forminator no longer throws the error I reported earlier.
    Weird thing is that it actually throws the error in Forminators’ main.js file and only on the Forminator Settings page, so maybe you can check if that is all as it is supposed to be.

    I did however notice another error in the Forminator Settings pages when there is no site/secret keys filled in. This happens both in Firefox and Chrome on clean installs (WP’s twentynineteen theme with just the Forminator plugin):

    Uncaught Error: reCAPTCHA placeholder element must be an element or id

    When I fill in the site/secret keys and reload the page, the error is gone. So it doesn’t break anything, I just wanted to let you know. Hope it helps.

    Hi @neejoh,

    Hope you had a nice time during the holidays ??

    Thank you for checking this and providing us with more information, can you tell me which 3rd plugin was causing this so I could have our devs look at it and see if we could do something from our end to get around the conflict?

    I did however notice another error in the Forminator Settings pages when there is no site/secret keys filled in. This happens both in Firefox and Chrome on clean installs (WP’s twentynineteen theme with just the Forminator plugin):

    I can replicate this as well, but it seems that it doesn’t affect any functionality, I will nonetheless report it for our devs to check it out ??

    Cheers,
    Predrag

    Thread Starter Ronaldt

    (@neejoh)

    It’s a third party premium plugin named CCL (custom-login form plugin).
    We also contacted them about the problem and they rewrote the script to vanilla javascript which is better. Basically what it did before was:

    init.php

    public function setScriptsAndStyles(){
      // ..
      wp_enqueue_script( 'form-frontend', Utils::plugin_url() . 'js/form-frontend.js', array('jquery'), '1.1.19', true );
      // ..
    }
    add_action( 'wp_enqueue_scripts', [$this, 'setScriptsAndStyles'] );

    And this is where it actually went wrong:

    js/form-frontend.js

    jQuery.noConflict(); // this was the problem
    jQuery( document ).ready(function( $ ) {
      // Autofocus on login form
      if( $('input#user_login').length > 0 ) {
        $('input#user_login').focus();
      }
    });
    

    Hope it helps to replicate it.

    Thanks,
    Ronald

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello Ronald,

    Thank you for the additional information, I will check with our developer if they will be able to tell more based on this part of the code.
    We will keep you posted.

    kind regards,
    Kasia

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello Ronald,

    Our developer checked this and this should not be an issue from above version 1.6 – current version is 1.6.0.3 – are you still facing this?

    kind regards,
    Kasia

    Thread Starter Ronaldt

    (@neejoh)

    Hi @wpmudev-support2, I’m not able to check since the other plugin changed their code to vanilla javascript (which is much better for simple code like this, if you ask me). I don’t have the original code with the jQuery.noConflict() any more to test with.

    Thanks for the follow up Kasia.
    Wish I could be of more help, but I trust in you haha

    Kind regards,
    Ronald

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“$ is not a function” error on settings page’ is closed to new replies.