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 change background color in the Notepad++ text editor?
- What are all the available parameters for query_posts?
- Does WordPress work without a theme?
- Link to specific Customizer section
- How do I change the header image height in Twenty Seventeen?
- Is it OK to remove theme credits from footer? [duplicate]
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- How to create a new theme from scratch?
- What theme is good for posting code? [closed]
- Difference between stylesheet_directory and template_directory
- Adding a Template to the Page Attributes Panel for both Posts and Pages?
- How do you change the theme location?
- How to see files in directories in “Edit Themes” screen
- WordPress generating 404 on .mp4 file in theme folder
- Why are my widgets not saving when being added to a sidebar?
- Building useful features into your theme
- How to remove “Proudly powered by WordPress” in Twenty Sixteen (2016) theme?
- How do I put my comment form above the comments?
- How can I check for malware in a Theme? [closed]
- Editing theme files and access to the Code pages only to super-admin?
- Edit theme wp_head
- Current theme broken – after server and domain migration
- Theme Advanced Styles in Visual Editor and Paragraphs
- Enqueue different stylesheets using IE conditionals
- Categories for Pages Not Saving in Admin with Custom Categories Metabox?
- Switch Theme Through Options Panel
- Override parent theme translation on child theme
- Forbidden 403 error, permission to access, unable to read htaccess
- Theme of codinghorror.com
- Weird post pagination url redirect
- How get Themes list via REST api?
- Activate a new WordPress Theme Only for Admins
- WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]
- How to add template to theme in WP
- How do I copy my Parent Templates to my Child Templates?
- How can I show more than 15 themes at a time in the admin menu?
- What is the WordPress Pinecone sitting on top of? [closed]
- Theme Editor Not Showing
- Pros and cons of using Backbone for WordPress theming [closed]
- Can I create multiple instances of the BuddyPress Activity Stream with separate themes? [closed]
- Download WordPress.com theme: how?
- Can I rename a theme’s folder and still receive updates?
- Child theme not visible
- Custom theme folder
- How to load parent theme style.css?
- Create a dashboard-style site (not WordPress dashboard) – is there a theme? [closed]
- Help with WordPress Query
- How to setup a new WordPress theme without deactivating the current theme?
- WordPress is not able to change themes
- How do I set the featured image size on the single post?
- Are theme .php files stored in the database?
- Inject widgets from one sidebar into another with PHP
- Where all are child themes recorded when they are created in WordPress
- Using custom JS plugins with WordPress?
- I have some doubts regarding how to implement child theme
- Execute filter in theme as last
- Why style.css with ?ver=3.9.2 not updating as the one without ?ver=3.9.2?
- An unexpected error occurred. Something may be wrong with WordPress.org
- Inconsistent translation on a WP site
- Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10)
- how to remove category nav from Bueno (WordPress Theme) header [closed]
- How can I have different theme with same booking table? [closed]
- Updating my free theme delete all my changes [closed]
- Web site Header tag links some resources with HTTPS
- Do not show one specific widget on one specific page
- Website redesign – New theme – Help needed
- ‘Add New’ button not present [closed]
- How to style the post previews/links without it affecting the main posts?
- customize color in WP child theme doesn’t saved
- Remove Commenting on Certain Pages
- how would I change background color of a theme using a plugin?
- How i can put on my wordpress the demo of a theme?
- WordPress keeps switching back to empty template
- Entire VPS locks up when using particular theme [closed]
- Advice for a Newbie WordPress Web Designer/ Themes? [closed]
- How to create and add js and css file when server is not on my PC?
- Obtaining the original unchanged Theme [closed]
- How to assign posts to different themes? [closed]