Okay, to answer my own question – I just had to rewrite the function and use .on(), as it listens to changes in the DOM. Like this:
$(document).on( 'click', '.email', function() {
var $this = $(this);
$this.parent().toggleClass('open');
});
Inspired by this piece of documentation:
https://facetwp.com/use-jquery-on-instead-of-click/
Related Posts:
- Pass PHP variable to javascript
- force enqueue script to be first in order of prominence
- How can I make default jquery version of WordPress “async”?
- Help making my pagination plugin better
- Handling jQuery Component Collision
- How to Add jQuery Infinite Scroll to My Custom Archive Page
- Is dynamic forms/entries possible in Widget?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Editor not displaying dynamically after clicking on the button
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- Check javascript file Proper way in functions.php
- WordPress Plugin development Call to undefined function jQuery()
- How to load default scripts included with WordPress correctly?
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Ajax with jQuery UI dialog not working
- WordPress 3.5 Media Manager – add a button
- Handling jQuery Component Collision
- How do I make sure a plugin loads a script after jQuery
- Add get_option to jquery
- Check if email address exists front end with AJAX in a plugin
- Confused about shortcode and settings values
- Running jquery script after shortcode [closed]
- scrolltop always 0, can’t trigger script
- Bootstrap Drop Down menu is not working
- Change upload folder for a CPT
- How to hide CSS by default and show on button press
- Uncaught TypeError: jQuery(…).flipster is not a function in wordpress
- Redux Framework: Page freezes on typing in Editor
- How can I inject options into an select tag inside the widget form?
- jquery tinymce and bundled wp plugins
- Display wordpress post’s in popup?
- Using color picker in plugin, does input attribute order matter?
- Loading a purchased jquery plugin in a wordpress theme
- Post Comments with Ajax in WordPress
- Integrating jQuery Datatables with Editor into wordpress admin
- Stop WordPress processing Javascript as text
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- wordpress add_action() issue in ajax call
- Localizing methods for jQuery append prepend wrap parent
- JQuery prepend a function
- Register google jquery gets overwritten by plugin
- How to best create a jQuery Slider to display a native wordpress gallery?
- Enqueue script: link not working in page source
- Custom meta box with jQuery.sortable custom post type list
- How to include my Ajax calls in one function instead of calling different ones every time?
- Load CSS files in header of Bones theme?
- FancyBox JS stopped working on multiple sites. Custom plugin responsible. Urgent help needed
- Portfolio Slideshow Sliders Behaving Oddly When in jQuery Ui Tabs
- jQuery(‘#news-ticker’).cycle is not a function
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- Using AJAX to run SQL statement and populate dropdown
- WordPress slider that allows image, headline, text, and button?
- Javascript from Easy-Fancybox place into footer
- Adding a jQuery modal dialog to the admin area
- WordPress plugin isn’t loading completely
- Jquery POST Ajax Return null data in wordpress
- WordPress jQuery Post – Amending Variable Value Within Function Command
- Overriding inline !important CSS with Javscript code snippet with media query
- WP Ajax DB issues
- Get the link title attribute and send it google analytics as custom label via google tag manager using beehive pro for WordPress
- Ajax Call not Working in Plugin
- jQuery Ajax not loading page with ACF fields
- Mixed content error after adding SSL certificate
- update_post_meta is not working for me when I use e.preventDefault for update button
- Website always load twice on start
- Hide button after form submit and save state to localstorage
- jQuery works instead of $
- checkout stripe with plugin contact form
- Uncaught TypeError: Cannot read property ‘cycle’ of undefined
- myStickymenu hide on scroll up to certain Y values
- How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- Help with customising love it plugin (use within foreach)
- Can’t find variable is_single in my jQuery plugin
- How to install jquery dotdotdot plugin for WordPress?
- Specific plugin script not working on subdomain
- Javascript in plugin not working
- Theme Load Error
- How to Add Jquery FullCalendar in wp plugin in admin
- Creating a comments voting system
- Plugin program: JQuery not working in this plugin
- What is the process for reimplementing a back up WordPress?
- Ajax, jQuery and WordPress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- Add jQuery in dashboard when is already added in main plugin page
- jQuery loaded in wrong order for non-admin page views only
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- PHP and Jquery pass value from form. Update function on DataBase
- WordPress plugin ajax post parameter
- get_option include in my adsense
- Plugin use of ajax/jquery depending dropdown
- Load css classes after using ajax calls
- How to resolve these findings from security audit
- Integrating WordPress Content into a jQuery Slider
- Animate like Stack exchange frequently asked questions [closed]
- Change page content based on dropdown selection