Skip to content

Instantly share code, notes, and snippets.

@mido1983
Created November 25, 2019 14:32
Show Gist options
  • Save mido1983/951004976efbecb0bfc870d5888b281c to your computer and use it in GitHub Desktop.
Save mido1983/951004976efbecb0bfc870d5888b281c to your computer and use it in GitHub Desktop.
JQuery is not working in wordpress – Solution
/*Problem
The jQuery is not working in WordPress plug-in writing? When you try to test a simple jQuery effect like following */
$(document).ready(function(){
alert('test');
});
Solution
In WordPress, the$() syntax is always used by other scripting library, and causing the conflict issue and fail to call the jQuery function. You should use jQuery() instead…
jQuery(document).ready(function(){
alert('test');
});
Copy
Alternatively, you can use noConflict() …
$j=jQuery.noConflict();
// Use jQuery via $j(...)
$j(document).ready(function(){
alert('test');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment