Your issue is that you are trying to use the normal jQuery shortcut ($) which doesn’t work by default as the WordPress version of jQuery is in compatibility mode. You need to wrap the code in your custom.js file in an anonymous function to map jQuery to $ as shown below:
(function($) {
//Your code here
})( jQuery );
or alternatively, replace all instances of ‘$’ with ‘jQuery’.
Related Posts:
- I can’t enqueue my scripts – They literally aren’t being added to my site
- How can i unload effect.min.js file?
- AJAX handler throws 400 (Bad request) – why?
- ajax live search for post title
- Apply jquery script to only woocommerce product pages and categories
- Replacing select2 in admin backend for all selects
- How to save Uploaded image in custom option panel?
- jQuery plugin function is not a function
- Display a function using AJAX
- Enqueuing Script in functions.php vs on the page
- Unable to get_the_content(); of a post in WordPress via AJAX
- Add external js file to footer with id
- Ajaxing function in widget class
- How to load some jquery code to make validation in the theme customizer?
- woocommerce target button with class after ajax update
- Move jQuery and Migrate to footer?
- Replace menu links with # and add name to its li
- Why won’t my scripts load?
- Loading CDN that requires jQuery in WordPress
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Right way to update widget on dynamic new input field
- Not sure if enqueuing js scripts properly
- Wp_query function to search from product_title ‘OR’ product tags name
- Allow Post Author to be 0 on Update
- Trouble with adding a wp_enqueue_script on wordpress
- Scripts not appending to element in AJAX call – why?
- How to change the order of Jquery in the footer of my theme?
- How to search using ajax for exact phrase or words in an input field?
- how to en-queue jQuery to load before the tag
- Jquery implementation not working on page reload
- Attempt to change jQuery version caused White Screen of Death
- PHP mixed with some JS code to update WordPress theme settings
- Load jquery only for certain pages in the backend
- Change CSS for logged in users
- Always the Latest google jQuery instead of default WordPress jQuery
- Add a jQuery Function
- jQuery does not work
- using jQuery on only one page
- Can’t call Javascript function – scope?
- Generate featured images old posts
- Changing parent element’s class or style
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- echo custom fields with AJAX
- Scripts not loading when using the wp_enqueue_scripts action
- Adding jQuery datepicker to Custom Post Type Metabox [closed]
- In jquery use php variable to execute an enqueued jquery file
- Run a jquery script on on a certain template page
- Add php code to wp_print_scripts?
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Where is this JQuery coming from?
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- Load scripts for do_shortcode( ‘ [ my_shortcode ] ‘ )
- How to load jQuery in TOP of wp_footer?
- Passing Jquery value to WordPress function
- WordPress can’t get jquery/unslider to work
- Add loggedout class on body using a function or JS
- Are innerHTML elements visible to jQuery functions?
- Include Jquery libraries in wordpress theme?
- get content from page through AJAX
- How to setup a popup registeration page in wordpress with function.php
- colorbox not loading in
- How to add php within jquery
- Help with IF has focus then… statment
- wp_enqueue_script() not working
- Get URLs for AJAX Filter Checkboxes WordPress
- wp_set_object_term via js btn frontend
- How to force one script to load before google tag manager script
- Populate Product Regular Price with a calculated ACF Field Value
- Hide ‘add to cart’ when certain value in dropdown is selected
- Ajax Form Issues using Lightsail (AWS)
- What is the earliest Hook a Script can use?
- WordPress does not load jQuery
- post value to function with Ajax and jQuery
- Images with overlay
- How to use `foreach()` in ajax call
- How To Display Author Popup on Entry Meta (Genesis Framework)?
- Multiple Notifications SetInterval
- How do i create a search option for pdf’s only
- WordPress Ajaxifying not working properly
- Execute jQuery with custom event listener after successfully add an item to the cart
- Load scripts into an AJAX div
- Load scripts into an AJAX div
- True parameter but jquery register in header and not in the footer with wp_register_script
- WordPress Jquery+scripts enqueue issue
- Moving CDN jQuery to footer does not work?
- Adding a jQuery rotator function
- Why are some custom javascript files working but some are not
- WordPress Javascript Widget jQuery Dependency Issue
- jQuery HoverIntent is not a function
- How to use different jquery function of idangero swiper dependant on page template?
- Ajax call does not work for this custom code
- How do I get my nav menu to show sub pages?
- Having problems loading Jquery in functions.php
- Owl Carousel and WordPress Integration Via WP_Enqueue
- AJAX values converted to PHP Variables?
- Animated Accordion [closed]
- Auto updating JavaScript dependancy in functions.php
- Loading newest dependency javascript module file in functions.php
- iOS and ajaxComplete