Support

Home Forums Event Espresso Premium "Add more attendees" toggle not working – No JS errors in console

"Add more attendees" toggle not working – No JS errors in console

Posted: September 21, 2013 at 3:51 pm


Sarah Rogers

September 21, 2013 at 3:51 pm

Hello there, I cannot get the toggle to work on my events.

http://kindragoehler.com/mbi/funny/event-registration/?ee=43

I’m not getting errors in my console, and it appears to be a theme related problem – it worked fine with 2011. Do you have any idea about how to resolve this?

Thank you!


Dean

September 23, 2013 at 1:32 am

Hi Sarah,

I am getting an error “Uncaught ReferenceError: jQuery is not defined”.

It looks like jQuery is being loaded in the footer, however there are a few jQuery scripts being loaded in the header, so they are failing as jQuery isn’t loaded.


Sarah Rogers

September 23, 2013 at 11:58 am

Hi Dean,

I turned off all of my other plugins, and I’m not getting the JS errors in my console at all. Does Event Espresso require that jQuery load in the header?

Thank you,
Kindra


Josh

  • Support Staff

September 23, 2013 at 12:31 pm

Hi there,

The Event Espresso registration form doesn’t necessarily require that jQuery be loaded into the head of the document. It will work as long as the jQuery library loads one time before the jQuery dependent scripts.

I checked the page you linked to and it turns out that jQuery is being loaded right after the opening head tag:

<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" ></script>

Which isn’t standard for WordPress. Usually WordPress will load its copy of jQuery either at the wp_head() or the wp_footer() actions. It looks like the theme might be missing wp_footer() from its footer.php template as no scripts are currently being loaded from there.


Sarah Rogers

September 23, 2013 at 12:42 pm

Hi Josh,

Sorry, I was trying to fix things while you were also taking a look at it 🙂
I dequeued WP’s copy of jQuery to force it to load first, just to see if that was the problem.

Since I made that change, I am getting this JS error in my console – espresso_add_reg_attendees is not defined.

Any ideas?

Thanks,
Kindra


Josh

  • Support Staff

September 23, 2013 at 2:42 pm

The WordPress version of jQuery should be loaded, not the other one.

espresso_add_reg_attendees gets defined on line 221 of /event-espresso/includes/functions/main.php via the wp_localize_script function. So I would check to make sure there first and make sure the event_espresso_additional_attendees function isn’t getting overridden via a custom function. If you look at line 116 of the same main.php file you’ll see it’s pluggable, and Event Espresso will check for the same function in /wp-content/uploads/espresso/custom_functions.php and if it’s there it will load the custom one instead.

Other things to check:

1) The theme may be loading scripts out of the normal WP order, so you can rule that out by temporarily installing the default WordPress theme. The theme test drive plugin will allow you to test the default theme without actually uninstalling the current theme.

2) Since there are copies of registration_page.php and registration_page_display.php in the /wp-content/uploads/espresso/templates directory these may have been altered and the modifications may be affecting the built-in Event Espresso functions. You can force the default Event Espresso templates to load up by re-naming the template files in the /wp-content/uploads/espresso/templates location.


Sarah Rogers

September 23, 2013 at 8:08 pm

Thanks Josh, you pointed me in the right direction.

Cheers,
Kindra

The support post ‘"Add more attendees" toggle not working – No JS errors in console’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso