• Resolved carlotums

    (@carlotums)


    Went to a same topic which was resolved but didn’t say how it got resolved
    <script>
    jQuery(function($) {
    console.log(“Fires!”);
    $.fn.almComplete = function(alm){
    console.log(“Doesn’t fire”);
    };
    });
    </script>

    originally the code was
    $(function() {
    $.fn.almComplete = function(alm){
    if(wpcf7){
    wpcf7.initForm( $(‘.wpcf7-form’));
    }
    };
    })(jQuery);

    but for some weird reason this:
    $(function() {
    //codes here
    })(jQuery); //returns (index):825 Uncaught TypeError: $(…) is not a function

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @carlotums,
    Maybe you could try the following solution found in the FAQ?
    https://connekthq.com/plugins/ajax-load-more/docs/faqs/#17

    Let me know if this helps.

    Thread Starter carlotums

    (@carlotums)

    just figured that script must be inside the template and not in the footer. it’s working now

    Hi there. I am having them same problem. I have added these two snippets to my repeater template

    Number 1

    $(function() {
    	$.fn.almComplete = function(alm){
    		alert("loaded");
    	};
    })(jQuery);

    gets this error:
    VM49:13 Uncaught TypeError: $(…) is not a function

    Number 2

    jQuery(document).ready(function ($) {
    	$.fn.almComplete = function(alm){
    		alert("loaded");
    	};
    });

    This throws no error but I don’t see the alert – nothing happens.

    I have also tried adding both to my scripts.js which gets loaded in the footer.

    Please help!

    • This reply was modified 5 years, 10 months ago by designagogo.
    • This reply was modified 5 years, 10 months ago by designagogo.
    Plugin Author Darren Cooney

    (@dcooney)

    @designagogo Don’t add this script to your Repeater Template, add it to your page template or site JS file.

    @dcooney thanks for the reply. I have tried both snippets of code in my scripts js file and in my index template which contains the load more shortcode. Same results as above – 1) error when I click the load more button, 2) nothing happens at all.
    Could it be something to do with the fact that my own theme loads a different version of jquery? (newer).

    UPDATE
    Just tried taking out my jquery and scripts and it works, so I think it is because of the two versions of jquery conflicting. I need my version as it is more recent and other jquery plugins require it. It gets loaded in the footer. Nout how I can resolve this though.

    • This reply was modified 5 years, 10 months ago by designagogo.
    Plugin Author Darren Cooney

    (@dcooney)

    Could be, can you share a link please.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘almComplete not firing’ is closed to new replies.