If you asking what is the replacement for .live()
it’s .on()`, for enabling event handling for dynamically added elements and that’s how you would use it.
$(document).on("click","#test-element",function() {});
so for your code.
$('body').on('click', '.top_add_card', function(event){
var parent = $(this).parent();
var $this_btn = $(this);
var $target_block = $this_btn.siblings('div');
event.preventDefault();
event.stopPropagation();
if(parent.hasClass('active') && $target_block.hasClass('hm_active_prep')){
$target_block.fadeOut(function(){
parent.removeClass('active');
}
}
});
This would work for dynamically adding elements too. because thats the main purpose of using .on(). read more about it here. https://api.jquery.com/on/
Related Posts:
- Jquery in Child Theme
- Want to have the Post editor remembering the last editing position
- When does WordPress wrap inline scripts in CDATA?
- Question about the way that wp_register_script works
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- Add js into a theme [closed]
- What’s the proper way to include inlined javascript-source?
- Retina JS not working
- JavaScript Files Registered in Parent Theme Won’t Load When Calling wp_enqueue_script() in Child Theme?
- Angular integration with homepage
- Twenty fifteen theme – change responsive menu condition
- how do i in ignore/disable/delete a javascript call from parent in child theme?
- Using JQuery to check for Rel Attribute of Image before Overriding It
- Getting a ‘slide down’ js panel implemented within WP
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- How to use only scripts from new theme?
- Webflow Interactions on WordPress site?
- share wrordpress data between two shared hosts using REST API
- Will this js code work in a page template?
- Divi theme including javascript
- Help!!! Old theme doesn’t load scripts and conflitcs with plugins
- How to remove pop up on website (css changes not visible)?
- how to add version of style.css in wordpress
- What is the role and history of the $content_width global variable?
- How to set thumbnail image for a (child) theme
- Add a page outside of the current theme?
- How to create a live demo page for a theme? [closed]
- Is it possible to stop a theme activation when a certain plugin is not activated
- add image size still doesn’t work even after regenerating thumbnails
- Best location for theme translation files
- How can I customize the search results in Bones theme?
- How to develop a theme while having another show up
- Use different javascript files for each page on website
- Being asked to update a theme that I don’t have
- Switch to other theme at URL
- How to go about pre generating css file with variables from theme options
- How to load a different theme for categories?
- How can I create an “excerpt” with text that won’t be displayed in the post itself?
- How to change sidebar per page?
- Add a series of checkboxes to theme options
- WordPress Theme Development Seemingly Awful Partitioning of Includes?
- Hide default “Recent Comments” Widget if there are no comments yet
- Theme Check warning wrong direcory for theme
- Static page not working
- Error defining a gutenberg block in a theme
- Looking for a fully customisable WP responsive theme to develop a small scale fiverr type site for voice artists [closed]
- Page dissapears when i click save
- Can’t resize logo in responsive theme?
- Is wordpress big enough for my project [closed]
- How to get theme screenshot
- Theme doesn’t support shortcodes
- i would like to have 3 default columns editable in guttenberg
- Define theme information other than through style.css
- Change avatar on themed profile page
- Trying to uninstall a theme, but it’s hijacking my home page
- Is it possible to open a page with a different theme?
- How to add some php code in header.php using plugin
- WordPress Theme and Plugin Name extraction
- Create page options for theme?
- Homepage showing a simple listing of title, featured image, then posted on
- Where is the best place to catch useragent?
- Knowing blog name using blog id
- Alternative to Back End Dashboard?
- Woocommerce single product image blurred and small. Actual image is big
- Adding a template in WPTouch
- one page wordpress theme
- Make the “Add New Post” one column for all users
- What happened to my Inactive Widgets?
- WP Nanoplex 1.0.3 malfunction
- Custom Plugin scripts from admin working in frontend
- Cannot change WordPress site title on a staged site
- How to add image from theme files to media library after theme activation?
- How to download my custom theme?
- Understanding the child / parent theme relationship
- i want remove class from post links
- Ensure Quality Transition to New WordPress Theme [closed]
- WordPress theme works on linux servers but white screen after move to Xampp
- Own WordPress theme with custom AFCs > Export all to theme format?
- Default and warning messages & no login
- Theme customizer hiding sections
- Customized wordpress theme locally put on someones WordPress account
- Uploaded WordPress theme not finding pages and css
- Speed issues because of CSS & JavaScript
- Updating theme resets theme options settings and widgets
- Mobile theme switching problems
- How to add different link on each Post [closed]
- EM in CSS different size on wordpress then elsewhere [closed]
- Flexslider not working for my custom theme WordPress
- Add Media + Quick Edit buttons not working
- WordPress Theme Problem
- Can I modify woocommerce themes that are under the GNU General Public License, version 2
- Best way to include pagination in a theme [closed]
- What happens to bespoke page template references on theme change?
- Javascript as Jquery Function Call?
- How to change the standard width of a page
- Is it possible to dynamically show different themes for different users? [duplicate]
- Why does WP theme not look like promoted? [closed]
- Remove image next to header image on WellExpo theme [closed]
- How do I get rid of the Mindblown and the book recommendations?
- Adding PHP code to single template in 2023 edition of WordPress theme