To use jquery in WordPress you have to use the jQuery function instead of $, this is done to avoid naming conflicts. A good way to return the jquery function to its original $ is to wrap the code inside a block like this:
jQuery(function($) {
//code here
});
Related Posts:
- pass object/JSON to wp_localize_script
- How to alter the text of the post “Excerpt” box label in WordPress post editor?
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to Change CSS Variable value in Theme Customizer Live Preview
- WordPress Google Maps in Custom Theme
- wp_enqueue_script being ignored in custom theme
- How to add oEmbed support to my theme?
- Getting jquery to work with custom theme
- Adding wp_enqueue_media(); causes problem
- How to correctly add JQuery in a WP theme?
- Toggle Sidebar Display
- Including Javascript options
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- Fancy-box Esay wordpress plugin fails to work on Multilingual site
- WP 3.1 upgrade breaks AutoFocus+ theme
- Difficulty loading jQuery with wp_enqueue_script
- Responsive embed for the video shortcode
- jQuery not available to other scripts
- My javascript jquery won’t work?
- Implementing FancyBox
- How to: JQuery multiple wordpress media uploader buttons in the same options page?
- Post thumbnail to append post content via ajax click event
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Using page-id-{ID} from body_class() in local dev, versus live staging
- My jQuery is enqueued properly. So why isn’t it working?
- Custom theme, contact form 7 & fast secure form doesn’t work
- Javascipt issue on custom theme
- How to make javascript work on theme options page
- JQuery undefined and Stylesheet loads in bottom along with js files
- Weirdness in jQuery supplied with WordPress
- jQuery from parent theme loaded with many other scripts in a single min.js file
- Trouble in enquing all js files under certain directory
- How do I implement jPanelMenu?
- loading javascript after jquery is loaded
- MapPress Easy Google Map in Jquery Tabs Problem
- I don’t think WordPress is loading jquery or bootstrap js
- how can i remove js file from my footer in wordpress
- How to properly use AWS SES for a contact form?
- How to load jQuery with Ajax in WP version 5.3.2?
- How to enqueue scripts properly with ES6 webpack?
- Infinite scroll without plugin using ajax
- change background image on scroll
- how to add jquery to wordpress
- jQuery conflict in WordPress, works fine in HTML
- How would I get this to work – send to post from thick box
- FitVid not working for iframes on particular theme install
- Enable WP to accept standard jQuery code embeding between the tags [duplicate]
- WordPress custom jquery not found
- Passing a location-dependent array via wp_localize_script within a shortcode
- enqueue script if page is not equal to
- apply_filters to featured image
- Set start page depending on screen width [closed]
- WordPress Subpages Fancybox Trouble
- IS there any reason not to include javascript in my own post’s embeds?
- Theme now uses require.js and enqueue script no longer works
- can’t add EVENT LISTENER to a element
- jQuery Snippet Not Working on WordPress Site [closed]
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)
- WordPress Includes mejs 404 error
- How to add a checkbox element to attachments editor with example
- Auto get_header and get_footer on every template?
- Is it possible to use line break in theme description?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Is tag default in WordPress?
- Why does WP recommend against custom favicon functionality in themes?
- Excluding a page with a certain name from wp_page_menu
- Widgets with groups / sub widgets? Widget in a widget?
- Avada resources still loading from localhost after database migration [closed]
- No Appearance –> Header menu
- Internationalization and functions that use it
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Update Custom Theme Version
- Storefront child theme not applying parent theme [closed]
- What can I use for small text when converting to WordPress?
- How to specify the “Main Sidebar” for a theme
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- How to develop a menu like wwe.com?
- Add tags to pages
- Why set a second parameter in the translate function?
- Replace site title with logo when logo is uploaded in customizer using
- How to create query to get top 3 sticky/latest posts
- Fatal error: Class ‘ZipArchive’ not found
- Is it possible to determine when user is at “Media > Add New” vs “Post > Add an Image”
- Modify available templates (in dropdown)
- Adding content inside the anchor tags within WordPress main nav
- Let visitors show/hide a type of content
- how to create/register menu items that can be added to menus later
- Theme starter content translation is not working
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- How to add an image to a theme page template in code?
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- Different stylesheet for different pages not working fully
- wpalchemy repeating fields dropdown issue
- Does WordPress require that your submitted theme supports multiple menu levels?
- Why does the first loop take arguments from the second loop?
- Is there any reason that other theme elements (such as nav menus) shouldn’t be within the loop?
- Is there any way to show child theme in theme detectors?